本文整理汇总了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)