Sha256: 47157c8ba3776f5641401d1cf939dd0f295b1a87113b45e5d1a5f61042966552
Contents?: true
Size: 797 Bytes
Versions: 5
Compression:
Stored size: 797 Bytes
Contents
class TypeCache { static _instance = null; typeCache = []; constructor() { if (TypeCache._instance === null) { TypeCache._instance = this; } return TypeCache._instance; } cacheType(typRegex) { this.typeCache.push(typRegex); } isTypeCacheEmpty() { return this.typeCache.length === 0; } isTypeAllowed(typeToCheck) { for (let pattern of this.typeCache) { if (new RegExp(pattern).test(typeToCheck.name)) { return true; } } return false; } getCachedTypes() { return this.typeCache; } clearCache() { this.typeCache = []; return 0; } } module.exports = TypeCache;
Version data entries
5 entries across 5 versions & 1 rubygems