@xyo-network/base
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -17,2 +17,4 @@ import { XyoLogger } from "@xyo-network/logger"; | ||
static stringify(value: any): string; | ||
private cache; | ||
protected getOrCreate<T>(name: string, initializer: () => T): T; | ||
/** Logs to the `info` level */ | ||
@@ -19,0 +21,0 @@ protected logInfo(message?: any, ...optionalParams: any[]): void; |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Monday, 19th November 2018 11:35:28 am | ||
* @Last modified time: Monday, 10th December 2018 1:26:51 pm | ||
* @License: All Rights Reserved | ||
@@ -19,2 +19,3 @@ * @Copyright: Copyright XY | The Findables Company | ||
const fast_safe_stringify_1 = __importDefault(require("fast-safe-stringify")); | ||
const xyo_simple_cache_1 = require("./xyo-simple-cache"); | ||
/** | ||
@@ -40,2 +41,8 @@ * A general purpose base class that can be used to incorporate | ||
} | ||
getOrCreate(name, initializer) { | ||
if (!this.cache) { | ||
this.cache = new xyo_simple_cache_1.XyoSimpleCache(); | ||
} | ||
return this.cache.getOrCreate(name, initializer); | ||
} | ||
/** Logs to the `info` level */ | ||
@@ -42,0 +49,0 @@ logInfo(message, ...optionalParams) { |
{ | ||
"name": "@xyo-network/base", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "A base class for the Xyo Network", | ||
@@ -10,3 +10,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@xyo-network/logger": "^0.2.1", | ||
"@xyo-network/logger": "^0.3.0", | ||
"fast-safe-stringify": "^2.0.6" | ||
@@ -23,3 +23,3 @@ }, | ||
}, | ||
"gitHead": "0635d162b742fbb5ee4f09d4e3faf5149b43eaf0" | ||
"gitHead": "55319bda08512a2701fb6494ad2e2526791e6bb7" | ||
} |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Monday, 19th November 2018 11:35:28 am | ||
* @Last modified time: Monday, 10th December 2018 1:26:51 pm | ||
* @License: All Rights Reserved | ||
@@ -15,2 +15,4 @@ * @Copyright: Copyright XY | The Findables Company | ||
import safeStringify from 'fast-safe-stringify' | ||
import { ISimpleCache } from "./@types" | ||
import { XyoSimpleCache } from "./xyo-simple-cache" | ||
@@ -43,2 +45,12 @@ /** | ||
private cache: ISimpleCache | undefined | ||
protected getOrCreate<T>(name: string, initializer: () => T): T { | ||
if (!this.cache) { | ||
this.cache = new XyoSimpleCache() | ||
} | ||
return this.cache.getOrCreate(name, initializer) | ||
} | ||
/** Logs to the `info` level */ | ||
@@ -45,0 +57,0 @@ protected logInfo(message?: any, ...optionalParams: any[]) { |
Sorry, the diff of this file is not supported yet
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
16421
23
338
+ Added@xyo-network/logger@0.3.1(transitive)
- Removed@xyo-network/logger@0.2.1(transitive)
Updated@xyo-network/logger@^0.3.0