@homebound/activesupport
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -136,2 +136,8 @@ type KeysOfType<T, TProp> = { | ||
declare global { | ||
interface Map<K, V> { | ||
getOrCreate(key: K, create: () => V): V; | ||
} | ||
} | ||
declare global { | ||
interface Object { | ||
@@ -138,0 +144,0 @@ toEntries<T, K extends string>(this: Record<K, T>): [K, T][]; |
@@ -227,2 +227,9 @@ var __defProp = Object.defineProperty; | ||
// src/map.ts | ||
Map.prototype.getOrCreate = function(key, create) { | ||
const result = this.get(key) ?? create(); | ||
this.has(key) || this.set(key, result); | ||
return result; | ||
}; | ||
// src/object.ts | ||
@@ -229,0 +236,0 @@ var allowOverwritingPrototypeExtension = { |
{ | ||
"name": "@homebound/activesupport", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/index.mjs", |
export * from "./array"; | ||
export * from "./map"; | ||
export * from "./object"; | ||
export * from "./utils"; |
Sorry, the diff of this file is not supported yet
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
93301
15
1082