本文整理匯總了TypeScript中vs/base/node/encoding.encodingExists函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript encodingExists函數的具體用法?TypeScript encodingExists怎麽用?TypeScript encodingExists使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了encodingExists函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('resolve terminal encoding (environment)', async function () {
process.env['VSCODE_CLI_ENCODING'] = 'utf16le';
const enc = await encoding.resolveTerminalEncoding();
assert.ok(encoding.encodingExists(enc));
assert.equal(enc, 'utf16le');
});
示例2: constructor
constructor(config: IRawSearch, walker: FileWalker) {
this.rootFolders = config.rootFolders;
this.extraFiles = config.extraFiles;
this.walker = walker;
this.contentPattern = strings.createRegExp(config.contentPattern.pattern, config.contentPattern.isRegExp, config.contentPattern.isCaseSensitive, config.contentPattern.isWordMatch, true);
this.isCanceled = false;
this.limitReached = false;
this.maxResults = config.maxResults;
this.worked = 0;
this.total = 0;
this.fileEncoding = encodingExists(config.fileEncoding) ? config.fileEncoding : UTF8;
}
示例3: getEncodingForResource
private getEncodingForResource(resource: uri, preferredEncoding?: string): string {
let fileEncoding: string;
const override = this.getEncodingOverride(resource);
if (override) {
fileEncoding = override; // encoding override always wins
} else if (preferredEncoding) {
fileEncoding = preferredEncoding; // preferred encoding comes second
} else {
fileEncoding = this.textResourceConfigurationService.getValue(resource, 'files.encoding'); // and last we check for settings
}
if (!fileEncoding || !encoding.encodingExists(fileEncoding)) {
fileEncoding = encoding.UTF8; // the default is UTF 8
}
return fileEncoding;
}
示例4:
return encoding.resolveTerminalEncoding().then(enc => {
assert.ok(encoding.encodingExists(enc));
assert.equal(enc, 'utf16le');
});
示例5:
encoding.resolveTerminalEncoding().then(encoding => {
assert.ok(encodingExists(encoding));
assert.equal(encoding, 'utf16le');
done();
}, done);