本文整理汇总了TypeScript中object-hash.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
mockConnectionProfile = {name: 'myProfile'};
mockConnectionProfile2 = {name: 'myOtherProfile'};
mockIdCard1 = sinon.createStubInstance(IdCard);
mockIdCard1.getUserName.returns('card1');
mockIdCard1.getConnectionProfile.returns(mockConnectionProfile);
mockIdCard1.getRoles.returns(['myRole']);
mockIdCard2 = sinon.createStubInstance(IdCard);
mockIdCard2.getUserName.returns('card2');
mockIdCard2.getConnectionProfile.returns(mockConnectionProfile);
mockIdCard2.getRoles.returns(['myOtherRole']);
mockIdCard3 = sinon.createStubInstance(IdCard);
mockIdCard3.getUserName.returns('card3');
mockIdCard3.getConnectionProfile.returns(mockConnectionProfile);
mockIdCard3.getRoles.returns(['myRole']);
mockIdCard4 = sinon.createStubInstance(IdCard);
mockIdCard4.getUserName.returns('card4');
mockIdCard4.getConnectionProfile.returns(mockConnectionProfile2);
mockIdCard4.getRoles.returns(['myRole']);
mockCardMap = new Map<string, IdCard>();
mockCardMap.set('uuid1xxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', mockIdCard1);
mockCardMap.set('uuid2xxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', mockIdCard2);
mockCardMap.set('uuid3xxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', mockIdCard3);
mockCardMap.set('uuid4xxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', mockIdCard4);
connectionProfileName = hash(mockConnectionProfile) + '-myProfile';
connectionProfileName2 = hash(mockConnectionProfile2) + '-myOtherProfile';
});
示例2: function
register(reducer:Reducer):Reducer{
let routeStateHistory:RouteStateHistory=new RouteStateHistory(hash(reducer));
this.routeStates.push(routeStateHistory);
return function (state,action) {
if(action.type==ROUTE_STATE_CHANGE){
let payload:IRouteStateChangeActionPayload=action.payload;
switch (payload.action){
case RouteStatePushAction:
routeStateHistory.push();
break;
case RouteStatePopAction:
routeStateHistory.pop(payload.number);
break;
case RouteStateReplaceAction:
routeStateHistory.pop(1);
routeStateHistory.push();
break;
}
return routeStateHistory.state;
}
let newState=reducer(state,action);
if(newState!=state){
routeStateHistory.update(newState);
}
return newState;
};
}
示例3: it
it('should get a qualified profile name for other connection profiles', inject([IdentityCardService], (service: IdentityCardService) => {
let connectionProfile = {
name: 'hlfv1'
};
let qualifiedName = service.getQualifiedProfileName(connectionProfile);
qualifiedName.should.equal(hash(connectionProfile) + '-hlfv1');
}));
示例4: add
add(item: fileCommon.IFile) {
let hash_key = hash(item);
this.container.set(hash_key, item);
}
示例5: hash
labels.map(label =>
label.set("id", hash(label.get("name").toLowerCase()))
示例6: hashArgs
private hashArgs(prices, budget) {
return hash(hash(prices.toJS()) + hash(budget));
}
示例7: createSnapshotIfMissing
describe(title, function(): void {
const prompt: Options = Object.assign({}, _options.prompt);
const scratchDir = path.join(__dirname, "../../../scratch");
const snapshotDir = path.join(__dirname, "../../../snapshots");
const hash = objectHash(Object.assign({ command }, prompt));
const hashDir = path.join(snapshotDir, hash);
this.timeout(5000);
before(function(): Promise<void> {
this.cwd = process.cwd();
this.end = new Promise(
(resolve, reject): void => {
this.runContext = helpers
.run(path.join(__dirname, `../../../generators/${name}`), {
tmpdir: false
})
.inDir(scratchDir)
.withArguments(args)
.withPrompts(prompt)
.on(
"ready",
// We don't want to import any source statically, so can't import
// type BaseGenerator
// @ts-ignore
(generator): void => {
// .yo-rc.json is in topdir and yeoman-test silently resets
// cwd to topdir (because of sinonjs masking the warning)
// so override the reset
generator.destinationRoot(scratchDir);
// Also override the reset for every single subgen
// @ts-ignore
generator._composedWith.forEach(
// We don't want to import any source statically, so can't import
// type BaseGenerator
// @ts-ignore
(gen): void => {
gen.destinationRoot(scratchDir);
}
);
}
)
.on("end", resolve)
.on("error", reject)
.toPromise();
}
);
return this.runContext;
});
after(function(): void {
return this.end.then(
(): void => {
process.chdir(this.cwd);
// Dynamic loading because the config package is linked
// statically via common/config.ts so it can't acknowledge the
// redefinition of process.env["NODE_CONFIG_DIR"] if any src is
// linked statically (they all import indirectly common/config.ts)
require("../../../generators/common/base-generator").reset();
}
);
});
const assertContent = Object.assign(
{
"package.json": true,
LICENSE: true,
"README.md": false
},
_options.assertContent
);
Object.keys(assertContent).forEach(
(key): void => {
if (typeof assertContent[key] === "function") {
assertContent[key] = (assertContent[key] as Function)();
}
}
);
const invalidFiles = (_options.expectInvalid || []).concat();
const {
matchFiles,
snapshotFiles,
expectedFiles,
noFiles
} = extractTestParameters(assertContent as {
[k: string]: RegExp[] | true;
});
const validInput = invalidFiles.length === 0;
if (validInput) {
it("should create only the expected files", async (): Promise<void> => {
let files = await readdir(scratchDir);
//.........这里部分代码省略.........