本文整理汇总了TypeScript中md5.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Promise
new Promise((resolve, reject) => {
// No 'reject' thus far
const https_options = {
hostname: MailChimpHostName,
path: MailChimpMembersPath + md5(emailaddress),
method: 'DELETE',
headers: {
'Authorization': MailChimpAuthorization
}
}
var req = https.request(https_options, (res: any) =>
readResponseBody(res)
.then((body: any) => {
if (res.Status < 200 || res.Status >= 300) {
BugTracker.InfoOnly('MailChimp API deleteMember', 'response.Status: ' + res.statusCode + ', response.Body: ' + body);
}
}));
req.on('error', (err: Error) => BugTracker.Warning('MailChimp API deleteMember Warning', err.message));
req.end();
resolve(null);
});
示例2: if
complete: () => {
hash = md5(JSON.stringify(plugins.concat(hashStrings)));
if (bootstrappedPlugins.has(hash)) {
observer.next(bootstrappedPlugins.get(hash));
observer.complete();
return;
}
const command = [ctx.location, '-s', solutionLocation].concat(
plugins.map(x => {
if (x.location) {
return `--plugins ${x.location}`;
} else if (x.version) {
return `--plugin-name ${x.name}@${x.version}`;
} else {
return `--plugin-name ${x.name}`;
}
})).join(' ');
exec(command, (error, stdout) => {
if (error) {
observer.error(error);
return;
}
const location = stdout.toString().trim();
if (location) {
// restore(location, ctx, logger).subscribe(observer);
return;
}
observer.next(ctx.location);
observer.complete();
});
}
示例3: deleteMember
function deleteMember(emailaddress) {
var https_options = {
hostname: MailChimpHostName,
path: MailChimpMembersPath + md5(emailaddress),
method: 'DELETE',
headers: {
'Authorization': MailChimpAuthorization
}
}
return new Promise(function (resolve, reject) {
// No 'reject' thus far
var req = https.request(https_options, function (res) {
readResponseBody(res)
.then(function (body) {
if (res.Status < 200 || res.Status >= 300)
Track.InfoOnly('MailChimp API deleteMember', 'response.Status: ' + res.statusCode + ', response.Body: ' + body);
});
});
req.on('error', function (e) {
Track.Warning('MailChimp API deleteMember Warning', e.message);
});
req.end();
resolve(null);
});
}
示例4: rp
checkSubscriberByEmail() {
const options = {
url: 'https://us8.api.mailchimp.com/3.0/lists/74a478b46d/members/' + md5(this.email),
method: 'GET',
headers: {
'Authorization': 'Basic ' + process.env.MAILCHIMP_API_KEY
}
}
return rp(options);
}
示例5: hash
/**
* Return hash string of the config and textlint version
* @returns {string}
*/
get hash() {
try {
const version = pkgConf.sync({ cwd: __dirname }).pkg.version;
const toString = JSON.stringify(this.toJSON());
return md5(`${version}-${toString}`);
} catch (error) {
// Fallback for some env
// https://github.com/textlint/textlint/issues/597
Logger.warn("Use random value as hash because calculating hash value throw error", error);
return crypto.randomBytes(20).toString("hex");
}
}
示例6: it
it("The set method should store the entry metadata", async () => {
expect(cachemap.metadata).lengthOf(1);
const metadata = cachemap.metadata[0];
expect(metadata.accessedCount).to.equal(0);
expect(metadata.added).to.be.a("number");
expect(metadata.cacheability).to.be.instanceOf(Cacheability);
expect(metadata.key).to.equal(md5(key));
expect(metadata.lastAccessed).to.be.a("number");
expect(metadata.lastUpdated).to.be.a("number");
expect(metadata.size).to.be.a("number");
expect(metadata.updatedCount).to.equal(0);
});
示例7: ascSign
export function ascSign(obj, key:string) {
let keys = _.keys(obj).sort();
let s = '';
for(let k of keys) {
let v = obj[k];
if (k != 'sign' && v && typeof v != 'Array') {
s += `${k}=${v}&`;
}
}
s += `key=${key}`;
console.log('str to sign:', s);
s = md5(s);
s = s.toUpperCase();
return s;
}
示例8: generateHashMD5
/**
*
*
* @param {string} data
* @returns {string}
*
* @memberOf Algorithm
*/
public static generateHashMD5(data:string):string{
return md5(data);
}
示例9: hash
/**
* Return hash string of the config and textlint version
* @returns {string}
*/
get hash() {
const pkgConf = require("read-pkg-up");
const version = pkgConf.sync({ cwd: __dirname }).pkg.version;
const toString = JSON.stringify(this.toJSON());
return md5(`${version}-${toString}`);
}