本文整理匯總了TypeScript中deep-equal.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should extend defaults with custom options object passed to constructor', () => {
let expected = extend({}, defaultOptions, {
trigger: [new Trigger('click')],
text: 'hello world',
placement: 'bottom'
}); // copy
expect(deepEqual((new Options({
trigger: 'click',
text: expected.text,
placement: expected.placement
})), expected)).toBe(true);
});
示例2: it
it('end to end test to check priority', () => {
let groupVal: Object = {
trigger: 'hover, click',
placement: 'top right',
showDelay: '123',
transitionPlacement: false
};
let schemaVal: Object = {
transitionPlacement: true
};
let jsonVal: Object = {
trigger: 'hover',
placement: 'top bottom',
showDelay: '123'
};
groupStore.add('group-test', { options: groupVal });
groupStore.add('schema-test', schemaVal);
let el = document.createElement('div');
el.setAttribute('popgun-group', 'group-test');
el.setAttribute('popgun-schema', 'schema-test');
el.setAttribute('popgun-json', JSON.stringify(jsonVal));
el.setAttribute('popgun-placement', 'top left');
expect(deepEqual(OptionsParser.fromElement(el), {
placement: 'top left',
showDelay: 123,
trigger: [new Trigger('hover')],
transitionPlacement: false
})).toBe(true);
});
示例3: extractProvide
function extractProvide(
statement: estree.Statement | estree.ModuleDeclaration,
provides: string[]
): boolean {
if (
statement.type === Syntax.ExpressionStatement &&
statement.expression.type === Syntax.CallExpression
) {
const callExp = statement.expression;
const firstArg = callExp.arguments[0];
if (
firstArg &&
firstArg.type === Syntax.Literal &&
deepEqual(espurify(callExp.callee), {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'goog',
},
property: {
type: 'Identifier',
name: 'provide',
},
})
) {
if (typeof firstArg.value !== 'string') {
throw new Error('Unexpected value: ' + firstArg.value);
}
provides.push(firstArg.value!);
return true;
}
}
return false;
}
示例4: deepEquals
export function structuralEquals<T extends object>(
actual: T,
expected: T
): boolean {
return deepEquals(actual, expected, { strict: true })
}
示例5: callAndReportFailure
? callAndReportFailure("Failed to strictly compare objects", () =>
strictDeepEquals(givenJSON, expectedJSON)