當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript has.default函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。