本文整理匯總了TypeScript中normalize-package-data.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: authors
export async function readPackageJson(file: string): Promise<any> {
const data = await readJson(file)
await authors(file, data)
normalizeData(data)
// remove not required fields because can be used for remote build
delete data.scripts
delete data.readme
return data
}
示例2: Error
/**
*
*
* Constructor
*
*
*/
constructor(
public options: PuppetOptions,
) {
super()
log.verbose('Puppet', 'constructor(%s)', JSON.stringify(options))
this.counter = PUPPET_COUNTER++
this.state = new StateSwitch(this.constructor.name, log)
this.options.timeout = this.options.timeout || DEFAULT_WATCHDOG_TIMEOUT
log.verbose('Puppet', 'constructor() watchdog timeout set to %d seconds', this.options.timeout)
this.watchdog = new Watchdog(1000 * this.options.timeout, 'Puppet')
const lruOptions: LRU.Options = {
max: 10000,
// length: function (n) { return n * 2},
dispose: function (key: string, val: Object) {
log.silly('Puppet', 'constructor() lruOptions.dispose(%s, %s)', key, JSON.stringify(val))
},
maxAge: 1000 * 60 * 60,
}
this.cacheContactPayload = new LRU<string, ContactPayload>(lruOptions)
this.cacheFriendshipPayload = new LRU<string, FriendshipPayload>(lruOptions)
this.cacheMessagePayload = new LRU<string, MessagePayload>(lruOptions)
this.cacheRoomPayload = new LRU<string, RoomPayload>(lruOptions)
this.cacheRoomMemberPayload = new LRU<string, RoomMemberPayload>(lruOptions)
/**
* 2. Load the package.json for Puppet Plugin version range matching
*
* For: dist/src/puppet/puppet.ts
* We need to up 3 times: ../../../package.json
*/
try {
const childClassPath = callerResolve('.', __filename)
log.verbose('Puppet', 'constructor() childClassPath=%s', childClassPath)
this.childPkg = readPkgUp.sync({ cwd: childClassPath }).pkg
} finally {
if (!this.childPkg) {
throw new Error('Cannot found package.json for Puppet Plugin Module')
}
}
normalize(this.childPkg)
}
示例3: authors
export async function readPackageJson(file: string): Promise<any> {
const data = await readJson(file)
await authors(file, data)
normalizeData(data)
return data
}