本文整理汇总了TypeScript中he.decode函数的典型用法代码示例。如果您正苦于以下问题:TypeScript decode函数的具体用法?TypeScript decode怎么用?TypeScript decode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decode函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
function(openControlledOntologyAcc, child) {
const { tagName, textContent } = child;
// using He.decode here, because some GPML at some point didn't use UTF-8
// for things like author names.
const textContentDecoded = He.decode(textContent);
const key = BIOPAX_TO_PVJSON.hasOwnProperty(tagName)
? BIOPAX_TO_PVJSON[tagName]
: tagName.replace(/^bp:/, "").toLowerCase();
openControlledOntologyAcc[key] = textContentDecoded;
return openControlledOntologyAcc;
},
示例2: parseSrcSet
opts => {
const parsed = parseSrcSet(he.decode(opts.srcset));
const firstCandidate: { url?: string } = parsed[0];
const { url } = firstCandidate || { url: null };
let encodedUrl = '';
// Must re-encode url prior to comparison with expected string.
if (url !== null) {
encodedUrl = he.encode(url);
} else {
encodedUrl = '';
}
expect(encodedUrl).toStrictEqual(opts.expect);
},
示例3: expect
expect(() => {
parseSrcSet(he.decode(opts.srcset));
}).toThrow(Error);
示例4: decodeIfNotEmpty
function decodeIfNotEmpty(input) {
return isEmpty(input) ? input : decode(input);
}