@wener/utils 1.1.38 → 1.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/objects/computeIfAbsent.ts"],"sourcesContent":["export function computeIfAbsent<K, V>(map: Map<K, V>, key: K, fn: () => V): V ;\nexport function computeIfAbsent<K extends string | symbol | number, V>(map: Record<K, V>, key: K, fn: () => V): V ;\nexport function computeIfAbsent<K, V>(map: any, key: K, fn: () => V): V {\n if (map instanceof Map) {\n if (!map.has(key)) {\n map.set(key, fn());\n }\n return map.get(key)!;\n }\n\n if (!map[key]) {\n map[key] = fn();\n }\n return map[key];\n}\n"],"names":["computeIfAbsent","map","key","fn","Map","has","set","get"],"mappings":"AAEA,OAAO,SAASA,gBAAsBC,GAAQ,EAAEC,GAAM,EAAEC,EAAW;IACjE,IAAIF,eAAeG,KAAK;QACtB,IAAI,CAACH,IAAII,GAAG,CAACH,MAAM;YACjBD,IAAIK,GAAG,CAACJ,KAAKC;QACf;QACA,OAAOF,IAAIM,GAAG,CAACL;IACjB;IAEA,IAAI,CAACD,GAAG,CAACC,IAAI,EAAE;QACbD,GAAG,CAACC,IAAI,GAAGC;IACb;IACA,OAAOF,GAAG,CAACC,IAAI;AACjB"}
1
+ {"version":3,"sources":["../../src/objects/computeIfAbsent.ts"],"sourcesContent":["export function computeIfAbsent<K, V>(map: Map<K, V>, key: K, fn: () => V): V;\nexport function computeIfAbsent<K extends string | symbol | number, V>(map: Record<K, V>, key: K, fn: () => V): V;\nexport function computeIfAbsent<K, V>(map: any, key: K, fn: () => V): V {\n if (map instanceof Map) {\n if (!map.has(key)) {\n map.set(key, fn());\n }\n return map.get(key)!;\n }\n\n if (!map[key]) {\n map[key] = fn();\n }\n return map[key];\n}\n"],"names":["computeIfAbsent","map","key","fn","Map","has","set","get"],"mappings":"AAEA,OAAO,SAASA,gBAAsBC,GAAQ,EAAEC,GAAM,EAAEC,EAAW;IACjE,IAAIF,eAAeG,KAAK;QACtB,IAAI,CAACH,IAAII,GAAG,CAACH,MAAM;YACjBD,IAAIK,GAAG,CAACJ,KAAKC;QACf;QACA,OAAOF,IAAIM,GAAG,CAACL;IACjB;IAEA,IAAI,CAACD,GAAG,CAACC,IAAI,EAAE;QACbD,GAAG,CAACC,IAAI,GAAGC;IACb;IACA,OAAOF,GAAG,CAACC,IAAI;AACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wener/utils",
3
- "version": "1.1.38",
3
+ "version": "1.1.39",
4
4
  "type": "module",
5
5
  "description": "Utils for daily use",
6
6
  "repository": {
@@ -15,6 +15,10 @@
15
15
  "types": "./src/index.ts",
16
16
  "default": "./lib/index.js"
17
17
  },
18
+ "./cn": {
19
+ "types": "./src/cn/index.ts",
20
+ "default": "./lib/cn/index.js"
21
+ },
18
22
  "./schema/typebox": {
19
23
  "types": "./src/schema/typebox/index.ts",
20
24
  "default": "./lib/schema/typebox/index.js"
@@ -1,5 +1,5 @@
1
- export function computeIfAbsent<K, V>(map: Map<K, V>, key: K, fn: () => V): V ;
2
- export function computeIfAbsent<K extends string | symbol | number, V>(map: Record<K, V>, key: K, fn: () => V): V ;
1
+ export function computeIfAbsent<K, V>(map: Map<K, V>, key: K, fn: () => V): V;
2
+ export function computeIfAbsent<K extends string | symbol | number, V>(map: Record<K, V>, key: K, fn: () => V): V;
3
3
  export function computeIfAbsent<K, V>(map: any, key: K, fn: () => V): V {
4
4
  if (map instanceof Map) {
5
5
  if (!map.has(key)) {