本文整理汇总了TypeScript中src/support/has.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: registerSuite
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has from 'src/support/has';
import global from 'src/support/global';
registerSuite({
name: 'native/WeakMap',
'verify API'(this: any) {
if (!has('es6-weakmap')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/WeakMap' ], dfd.callback((m: any) => {
/* tslint:disable-next-line:variable-name */
const WeakMap = m.default;
const weakmap = new WeakMap();
assert.instanceOf(weakmap, global.WeakMap);
}));
}
});
开发者ID:agubler,项目名称:shim,代码行数:20,代码来源:WeakMap.ts
示例2: registerSuite
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has from 'src/support/has';
import global from 'src/support/global';
registerSuite({
name: 'native/Set',
'verify API'(this: any) {
if (!has('es6-set')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/Set' ], dfd.callback((m: any) => {
/* tslint:disable-next-line:variable-name */
const Set = m.default;
const set = new Set();
assert.instanceOf(set, global.Set);
}));
}
});
开发者ID:agubler,项目名称:shim,代码行数:20,代码来源:Set.ts
示例3: registerSuite
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has from 'src/support/has';
import global from 'src/support/global';
registerSuite({
name: 'native/Map',
'verify API'(this: any) {
if (!has('es6-map')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/Map' ], dfd.callback((m: any) => {
/* tslint:disable-next-line:variable-name */
const Map = m.default;
const map = new Map();
assert.instanceOf(map, global.Map);
}));
}
});
开发者ID:agubler,项目名称:shim,代码行数:20,代码来源:Map.ts
示例4: registerSuite
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has from 'src/support/has';
import global from 'src/support/global';
registerSuite({
name: 'native/Symbol',
'verify API'(this: any) {
if (!has('es6-symbol')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/Symbol' ], dfd.callback((m: any) => {
/* tslint:disable-next-line:variable-name */
const Symbol = m.default;
const { isSymbol } = m;
const sym = Symbol('foo');
assert.typeOf(sym, 'symbol');
assert.isTrue(isSymbol(sym));
assert.isFalse(isSymbol('foo'));
assert.strictEqual(Symbol, global.Symbol);
[
'hasInstance',
'isConcatSpreadable',
'iterator',
'species',
'replace',
'search',
'split',
'match',
'toPrimitive',
开发者ID:agubler,项目名称:shim,代码行数:31,代码来源:Symbol.ts
示例5:
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has, { add as hasAdd } from 'src/support/has';
import global from 'src/support/global';
hasAdd('es6-number', 'EPSILON' in global.Number);
registerSuite({
name: 'native/number',
'verify API'(this: any) {
if (!has('es6-number')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/number' ], dfd.callback((num: any) => {
[
'EPSILON',
'MAX_SAFE_INTEGER',
'MIN_SAFE_INTEGER'
].forEach((value) => assert.isNumber(num[value]));
[
'isNaN',
'isFinite',
'isInteger',
'isSafeInteger'
].forEach((method) => assert.isFunction(num[method], `'${method}' should be a function`));
assert.strictEqual(Object.keys(num).length, 7);
}));
}
});
开发者ID:agubler,项目名称:shim,代码行数:30,代码来源:number.ts
示例6:
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has from 'src/support/has';
registerSuite({
name: 'native/math',
'verify API'(this: any) {
if (!has('es6-math-acosh')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/math' ], dfd.callback((math: any) => {
[
'acosh',
'asinh',
'atanh',
'cbrt',
'clz32',
'cosh',
'expm1',
'fround',
'hypot',
'imul',
'log2',
'log10',
'log1p',
'sign',
'sinh',
'tanh',
'trunc'
].forEach((method: string) => assert.isFunction(math[method], `Math "${method}" is not defined`));
开发者ID:agubler,项目名称:shim,代码行数:31,代码来源:math.ts
示例7:
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has from 'src/support/has';
registerSuite({
name: 'native/array',
'verify API'(this: any) {
if (!has('es6-array-from')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/array' ], dfd.callback((array: any) => {
assert.isFunction(array.from);
assert.isFunction(array.of);
assert.isFunction(array.copyWithin);
assert.isFunction(array.fill);
assert.isFunction(array.find);
assert.isFunction(array.findIndex);
assert.isFunction(array.includes);
assert.strictEqual(Object.keys(array).length, 7);
}));
}
});
开发者ID:agubler,项目名称:shim,代码行数:23,代码来源:array.ts
示例8:
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has, { add as hasAdd } from 'src/support/has';
import global from 'src/support/global';
hasAdd('es6-object', 'getOwnPropertySymbols' in global.Object);
registerSuite({
name: 'native/object',
'verify API'(this: any) {
if (!has('es6-object')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/object' ], dfd.callback((object: any) => {
[
'is',
'getOwnPropertySymbols',
'getOwnPropertyNames'
].forEach((method) => assert.isFunction(object[method]));
assert.strictEqual(Object.keys(object).length, 3);
}));
}
});
开发者ID:agubler,项目名称:shim,代码行数:24,代码来源:object.ts
示例9: Boolean
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has, { add as hasAdd } from 'src/support/has';
import global from 'src/support/global';
hasAdd('es6-iterator', Boolean(global.Symbol && global.Symbol.iterator && global.Array.prototype[Symbol.iterator]));
registerSuite({
name: 'native/iterator',
'verify API'(this: any) {
if (!has('es6-iterator')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/iterator' ], dfd.callback(function (iterator: any) {
assert.isFunction(iterator.isIterable);
assert.isFunction(iterator.isArrayLike);
assert.isFunction(iterator.get);
assert.isFunction(iterator.forOf);
assert.strictEqual(Object.keys(iterator).length, 4);
assert.isFunction(iterator.get([ 1, 2, 3 ]).next);
assert.isFunction(iterator.get('foo').next);
assert.isUndefined(iterator.get(1));
const results: any[] = [];
iterator.forOf([ 1, 2, 3, 4 ], (item: number, source: number[], doBreak: () => void) => {
results.push(item);
if (results.length === 3) {
doBreak();
}
});
开发者ID:agubler,项目名称:shim,代码行数:31,代码来源:iterator.ts
示例10:
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import has from 'src/support/has';
registerSuite({
name: 'native/string',
'verify API'(this: any) {
if (!has('es6-string-raw')) {
this.skip('No native support');
}
const dfd = this.async();
require([ 'src/native/string' ], dfd.callback((str: any) => {
[
'HIGH_SURROGATE_MIN',
'HIGH_SURROGATE_MAX',
'LOW_SURROGATE_MIN',
'LOW_SURROGATE_MAX'
].forEach((prop: string) => assert.isNumber(str[prop]));
[
'raw',
'fromCodePoint',
'codePointAt',
'repeat',
'startsWith',
'endsWith',
'includes'
].forEach((method: string) => assert.isFunction(str[method]));
assert.strictEqual(Object.keys(str).length, 11);
}));
开发者ID:agubler,项目名称:shim,代码行数:31,代码来源:string.ts
注:本文中的src/support/has.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论