@probe.gl/stats
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -20,3 +20,3 @@ import Stat from './stat'; | ||
/** Acquire a stat. Create if it doesn't exist. */ | ||
get(name: string, type?: string): Stat | null; | ||
get(name: string, type?: string): Stat; | ||
get size(): number; | ||
@@ -34,5 +34,5 @@ /** Reset all stats */ | ||
type?: string; | ||
}): Stat | null; | ||
}): Stat; | ||
} | ||
export {}; | ||
//# sourceMappingURL=stats.d.ts.map |
@@ -6,3 +6,3 @@ { | ||
"type": "module", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"keywords": [ | ||
@@ -37,3 +37,3 @@ "javascript", | ||
}, | ||
"gitHead": "691bfc682941f6ef68960ede7b711d014d74bb85" | ||
"gitHead": "6320ab819621b18ea25008a88458edf7f9069fd4" | ||
} |
@@ -27,3 +27,3 @@ // probe.gl, MIT license | ||
/** Acquire a stat. Create if it doesn't exist. */ | ||
get(name: string, type: string = 'count'): Stat | null { | ||
get(name: string, type: string = 'count'): Stat { | ||
return this._getOrCreate({name, type}); | ||
@@ -69,17 +69,15 @@ } | ||
_getOrCreate(stat: Stat | {name: string, type?: string}): Stat | null { | ||
if (!stat || !stat.name) { | ||
return null; | ||
} | ||
_getOrCreate(stat: Stat | {name: string, type?: string}): Stat { | ||
const {name, type} = stat; | ||
if (!this.stats[name]) { | ||
let result = this.stats[name]; | ||
if (!result) { | ||
if (stat instanceof Stat) { | ||
this.stats[name] = stat; | ||
result = stat; | ||
} else { | ||
this.stats[name] = new Stat(name, type); | ||
result = new Stat(name, type); | ||
} | ||
this.stats[name] = result; | ||
} | ||
return this.stats[name] || null; | ||
return result; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38485
703