@mado/utils 0.4.1 → 0.5.0

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.
Files changed (43) hide show
  1. package/dist/capitalize.cjs +1 -7
  2. package/dist/capitalize.cjs.map +1 -1
  3. package/dist/capitalize.js +1 -5
  4. package/dist/capitalize.js.map +1 -1
  5. package/dist/debounce.cjs +1 -18
  6. package/dist/debounce.cjs.map +1 -1
  7. package/dist/debounce.d.cts +3 -2
  8. package/dist/debounce.d.ts +3 -2
  9. package/dist/debounce.js +1 -16
  10. package/dist/debounce.js.map +1 -1
  11. package/dist/index.cjs +1 -24
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +1 -8
  16. package/dist/index.js.map +1 -1
  17. package/dist/invariant.cjs +1 -38
  18. package/dist/invariant.cjs.map +1 -1
  19. package/dist/invariant.d.cts +2 -2
  20. package/dist/invariant.d.ts +2 -2
  21. package/dist/invariant.js +1 -33
  22. package/dist/invariant.js.map +1 -1
  23. package/dist/is-nil.cjs +1 -7
  24. package/dist/is-nil.cjs.map +1 -1
  25. package/dist/is-nil.js +1 -5
  26. package/dist/is-nil.js.map +1 -1
  27. package/dist/is-object-like.cjs +1 -7
  28. package/dist/is-object-like.cjs.map +1 -1
  29. package/dist/is-object-like.js +1 -5
  30. package/dist/is-object-like.js.map +1 -1
  31. package/dist/is-plain-object.cjs +1 -13
  32. package/dist/is-plain-object.cjs.map +1 -1
  33. package/dist/is-plain-object.js +1 -11
  34. package/dist/is-plain-object.js.map +1 -1
  35. package/dist/remember.cjs +1 -14
  36. package/dist/remember.cjs.map +1 -1
  37. package/dist/remember.js +1 -12
  38. package/dist/remember.js.map +1 -1
  39. package/dist/storage-available.cjs +1 -19
  40. package/dist/storage-available.cjs.map +1 -1
  41. package/dist/storage-available.js +1 -17
  42. package/dist/storage-available.js.map +1 -1
  43. package/package.json +4 -4
@@ -1,8 +1,2 @@
1
- 'use strict';
2
-
3
- function capitalize(str) {
4
- return str.charAt(0).toUpperCase() + str.substring(1);
5
- }
6
-
7
- exports.capitalize = capitalize;
1
+ "use strict";function capitalize(str){return str.charAt(0).toUpperCase()+str.substring(1)}exports.capitalize=capitalize;
8
2
  //# sourceMappingURL=capitalize.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"capitalize.cjs","sources":["../src/capitalize.ts"],"sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n"],"names":["capitalize","str","charAt","toUpperCase","substring"],"mappings":";;AAAO,SAASA,UAAUA,CAACC,GAAW,EAAU;AAC9C,EAAA,OAAOA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,GAAGF,GAAG,CAACG,SAAS,CAAC,CAAC,CAAC;AACvD;;"}
1
+ {"version":3,"file":"capitalize.cjs","sources":["../src/capitalize.ts"],"sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n"],"names":["capitalize","str","charAt","toUpperCase","substring"],"mappings":"aAAO,SAASA,WAAWC,KACzB,OAAOA,IAAIC,OAAO,GAAGC,cAAgBF,IAAIG,UAAU,EACrD"}
@@ -1,6 +1,2 @@
1
- function capitalize(str) {
2
- return str.charAt(0).toUpperCase() + str.substring(1);
3
- }
4
-
5
- export { capitalize };
1
+ function capitalize(str){return str.charAt(0).toUpperCase()+str.substring(1)}export{capitalize};
6
2
  //# sourceMappingURL=capitalize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capitalize.js","sources":["../src/capitalize.ts"],"sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n"],"names":["capitalize","str","charAt","toUpperCase","substring"],"mappings":"AAAO,SAASA,UAAUA,CAACC,GAAW,EAAU;AAC9C,EAAA,OAAOA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,GAAGF,GAAG,CAACG,SAAS,CAAC,CAAC,CAAC;AACvD;;"}
1
+ {"version":3,"file":"capitalize.js","sources":["../src/capitalize.ts"],"sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n"],"names":["capitalize","str","charAt","toUpperCase","substring"],"mappings":"AAAO,SAASA,WAAWC,KACzB,OAAOA,IAAIC,OAAO,GAAGC,cAAgBF,IAAIG,UAAU,EACrD"}
package/dist/debounce.cjs CHANGED
@@ -1,19 +1,2 @@
1
- 'use strict';
2
-
3
- function debounce(func, wait = 166) {
4
- let timeout;
5
- function debounced(...args) {
6
- clearTimeout(timeout);
7
- timeout = setTimeout(() => {
8
- // @ts-ignore
9
- func.apply(this, args);
10
- }, wait);
11
- }
12
- debounced.cancel = () => {
13
- clearTimeout(timeout);
14
- };
15
- return debounced;
16
- }
17
-
18
- exports.debounce = debounce;
1
+ "use strict";function debounce(func,wait=166){let timeout;function debounced(...args){clearTimeout(timeout);timeout=setTimeout(()=>{func.apply(this,args)},wait)}debounced.cancel=()=>{clearTimeout(timeout)};return debounced}exports.debounce=debounce;
19
2
  //# sourceMappingURL=debounce.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"debounce.cjs","sources":["../src/debounce.ts"],"sourcesContent":["export interface Cancelable {\n cancel: () => void;\n}\n\nexport function debounce<T extends (...args: any[]) => any>(func: T, wait = 166): T & Cancelable {\n let timeout: ReturnType<typeof setTimeout>;\n\n function debounced(...args: Parameters<T>) {\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n // @ts-ignore\n func.apply(this, args);\n }, wait);\n }\n\n debounced.cancel = () => {\n clearTimeout(timeout);\n };\n\n return debounced as T & Cancelable;\n}\n"],"names":["debounce","func","wait","timeout","debounced","args","clearTimeout","setTimeout","apply","cancel"],"mappings":";;AAIO,SAASA,QAAQA,CAAoCC,IAAO,EAAEC,IAAI,GAAG,GAAG,EAAkB;AAC/F,EAAA,IAAIC,OAAsC;AAE1C,EAAA,SAASC,SAASA,CAAC,GAAGC,IAAmB,EAAE;IACzCC,YAAY,CAACH,OAAO,CAAC;IAErBA,OAAO,GAAGI,UAAU,CAAC,MAAM;AACzB;AACAN,MAAAA,IAAI,CAACO,KAAK,CAAC,IAAI,EAAEH,IAAI,CAAC;IACxB,CAAC,EAAEH,IAAI,CAAC;AACV,EAAA;EAEAE,SAAS,CAACK,MAAM,GAAG,MAAM;IACvBH,YAAY,CAACH,OAAO,CAAC;EACvB,CAAC;AAED,EAAA,OAAOC,SAAS;AAClB;;"}
1
+ {"version":3,"file":"debounce.cjs","sources":["../src/debounce.ts"],"sourcesContent":["export interface Cancelable {\n cancel: () => void;\n}\n\nexport type Debounced<T extends (...args: never[]) => unknown> = Cancelable &\n ((this: ThisParameterType<T>, ...args: Parameters<T>) => void);\n\nexport function debounce<T extends (...args: never[]) => unknown>(func: T, wait = 166): Debounced<T> {\n let timeout: ReturnType<typeof setTimeout>;\n\n function debounced(this: ThisParameterType<T>, ...args: Parameters<T>) {\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n func.apply(this, args);\n }, wait);\n }\n\n debounced.cancel = () => {\n clearTimeout(timeout);\n };\n\n return debounced;\n}\n"],"names":["debounce","func","wait","timeout","debounced","args","clearTimeout","setTimeout","apply","this","cancel"],"mappings":"aAOO,SAASA,SAAkDC,KAASC,KAAO,KAChF,IAAIC,QAEJ,SAASC,aAAyCC,MAChDC,aAAaH,SAEbA,QAAUI,WAAW,KACnBN,KAAKO,MAAMC,KAAMJ,OAChBH,KACL,CAEAE,UAAUM,OAAS,KACjBJ,aAAaH,UAGf,OAAOC,SACT"}
@@ -1,7 +1,8 @@
1
1
  interface Cancelable {
2
2
  cancel: () => void;
3
3
  }
4
- declare function debounce<T extends (...args: any[]) => any>(func: T, wait?: number): T & Cancelable;
4
+ type Debounced<T extends (...args: never[]) => unknown> = Cancelable & ((this: ThisParameterType<T>, ...args: Parameters<T>) => void);
5
+ declare function debounce<T extends (...args: never[]) => unknown>(func: T, wait?: number): Debounced<T>;
5
6
 
6
7
  export { debounce };
7
- export type { Cancelable };
8
+ export type { Cancelable, Debounced };
@@ -1,7 +1,8 @@
1
1
  interface Cancelable {
2
2
  cancel: () => void;
3
3
  }
4
- declare function debounce<T extends (...args: any[]) => any>(func: T, wait?: number): T & Cancelable;
4
+ type Debounced<T extends (...args: never[]) => unknown> = Cancelable & ((this: ThisParameterType<T>, ...args: Parameters<T>) => void);
5
+ declare function debounce<T extends (...args: never[]) => unknown>(func: T, wait?: number): Debounced<T>;
5
6
 
6
7
  export { debounce };
7
- export type { Cancelable };
8
+ export type { Cancelable, Debounced };
package/dist/debounce.js CHANGED
@@ -1,17 +1,2 @@
1
- function debounce(func, wait = 166) {
2
- let timeout;
3
- function debounced(...args) {
4
- clearTimeout(timeout);
5
- timeout = setTimeout(() => {
6
- // @ts-ignore
7
- func.apply(this, args);
8
- }, wait);
9
- }
10
- debounced.cancel = () => {
11
- clearTimeout(timeout);
12
- };
13
- return debounced;
14
- }
15
-
16
- export { debounce };
1
+ function debounce(func,wait=166){let timeout;function debounced(...args){clearTimeout(timeout);timeout=setTimeout(()=>{func.apply(this,args)},wait)}debounced.cancel=()=>{clearTimeout(timeout)};return debounced}export{debounce};
17
2
  //# sourceMappingURL=debounce.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debounce.js","sources":["../src/debounce.ts"],"sourcesContent":["export interface Cancelable {\n cancel: () => void;\n}\n\nexport function debounce<T extends (...args: any[]) => any>(func: T, wait = 166): T & Cancelable {\n let timeout: ReturnType<typeof setTimeout>;\n\n function debounced(...args: Parameters<T>) {\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n // @ts-ignore\n func.apply(this, args);\n }, wait);\n }\n\n debounced.cancel = () => {\n clearTimeout(timeout);\n };\n\n return debounced as T & Cancelable;\n}\n"],"names":["debounce","func","wait","timeout","debounced","args","clearTimeout","setTimeout","apply","cancel"],"mappings":"AAIO,SAASA,QAAQA,CAAoCC,IAAO,EAAEC,IAAI,GAAG,GAAG,EAAkB;AAC/F,EAAA,IAAIC,OAAsC;AAE1C,EAAA,SAASC,SAASA,CAAC,GAAGC,IAAmB,EAAE;IACzCC,YAAY,CAACH,OAAO,CAAC;IAErBA,OAAO,GAAGI,UAAU,CAAC,MAAM;AACzB;AACAN,MAAAA,IAAI,CAACO,KAAK,CAAC,IAAI,EAAEH,IAAI,CAAC;IACxB,CAAC,EAAEH,IAAI,CAAC;AACV,EAAA;EAEAE,SAAS,CAACK,MAAM,GAAG,MAAM;IACvBH,YAAY,CAACH,OAAO,CAAC;EACvB,CAAC;AAED,EAAA,OAAOC,SAAS;AAClB;;"}
1
+ {"version":3,"file":"debounce.js","sources":["../src/debounce.ts"],"sourcesContent":["export interface Cancelable {\n cancel: () => void;\n}\n\nexport type Debounced<T extends (...args: never[]) => unknown> = Cancelable &\n ((this: ThisParameterType<T>, ...args: Parameters<T>) => void);\n\nexport function debounce<T extends (...args: never[]) => unknown>(func: T, wait = 166): Debounced<T> {\n let timeout: ReturnType<typeof setTimeout>;\n\n function debounced(this: ThisParameterType<T>, ...args: Parameters<T>) {\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n func.apply(this, args);\n }, wait);\n }\n\n debounced.cancel = () => {\n clearTimeout(timeout);\n };\n\n return debounced;\n}\n"],"names":["debounce","func","wait","timeout","debounced","args","clearTimeout","setTimeout","apply","this","cancel"],"mappings":"AAOO,SAASA,SAAkDC,KAASC,KAAO,KAChF,IAAIC,QAEJ,SAASC,aAAyCC,MAChDC,aAAaH,SAEbA,QAAUI,WAAW,KACnBN,KAAKO,MAAMC,KAAMJ,OAChBH,KACL,CAEAE,UAAUM,OAAS,KACjBJ,aAAaH,UAGf,OAAOC,SACT"}
package/dist/index.cjs CHANGED
@@ -1,25 +1,2 @@
1
- 'use strict';
2
-
3
- var capitalize = require('./capitalize.cjs');
4
- var debounce = require('./debounce.cjs');
5
- var invariant = require('./invariant.cjs');
6
- var isNil = require('./is-nil.cjs');
7
- var isObjectLike = require('./is-object-like.cjs');
8
- var isPlainObject = require('./is-plain-object.cjs');
9
- var remember = require('./remember.cjs');
10
- var storageAvailable = require('./storage-available.cjs');
11
-
12
-
13
-
14
- exports.capitalize = capitalize.capitalize;
15
- exports.debounce = debounce.debounce;
16
- exports.InvariantError = invariant.InvariantError;
17
- exports.invariant = invariant.invariant;
18
- exports.invariantResponse = invariant.invariantResponse;
19
- exports.isInvariantError = invariant.isInvariantError;
20
- exports.isNil = isNil.isNil;
21
- exports.isObjectLike = isObjectLike.isObjectLike;
22
- exports.isPlainObject = isPlainObject.isPlainObject;
23
- exports.remember = remember.remember;
24
- exports.storageAvailable = storageAvailable.storageAvailable;
1
+ "use strict";var capitalize=require("./capitalize.cjs");var debounce=require("./debounce.cjs");var invariant=require("./invariant.cjs");var isNil=require("./is-nil.cjs");var isObjectLike=require("./is-object-like.cjs");var isPlainObject=require("./is-plain-object.cjs");var remember=require("./remember.cjs");var storageAvailable=require("./storage-available.cjs");exports.capitalize=capitalize.capitalize;exports.debounce=debounce.debounce;exports.InvariantError=invariant.InvariantError;exports.invariant=invariant.invariant;exports.invariantResponse=invariant.invariantResponse;exports.isInvariantError=invariant.isInvariantError;exports.isNil=isNil.isNil;exports.isObjectLike=isObjectLike.isObjectLike;exports.isPlainObject=isPlainObject.isPlainObject;exports.remember=remember.remember;exports.storageAvailable=storageAvailable.storageAvailable;
25
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { capitalize } from './capitalize.cjs';
2
- export { Cancelable, debounce } from './debounce.cjs';
2
+ export { Cancelable, Debounced, debounce } from './debounce.cjs';
3
3
  export { InvariantError, invariant, invariantResponse, isInvariantError } from './invariant.cjs';
4
4
  export { isNil } from './is-nil.cjs';
5
5
  export { isObjectLike } from './is-object-like.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { capitalize } from './capitalize.js';
2
- export { Cancelable, debounce } from './debounce.js';
2
+ export { Cancelable, Debounced, debounce } from './debounce.js';
3
3
  export { InvariantError, invariant, invariantResponse, isInvariantError } from './invariant.js';
4
4
  export { isNil } from './is-nil.js';
5
5
  export { isObjectLike } from './is-object-like.js';
package/dist/index.js CHANGED
@@ -1,9 +1,2 @@
1
- export { capitalize } from './capitalize.js';
2
- export { debounce } from './debounce.js';
3
- export { InvariantError, invariant, invariantResponse, isInvariantError } from './invariant.js';
4
- export { isNil } from './is-nil.js';
5
- export { isObjectLike } from './is-object-like.js';
6
- export { isPlainObject } from './is-plain-object.js';
7
- export { remember } from './remember.js';
8
- export { storageAvailable } from './storage-available.js';
1
+ export{capitalize}from"./capitalize.js";export{debounce}from"./debounce.js";export{InvariantError,invariant,invariantResponse,isInvariantError}from"./invariant.js";export{isNil}from"./is-nil.js";export{isObjectLike}from"./is-object-like.js";export{isPlainObject}from"./is-plain-object.js";export{remember}from"./remember.js";export{storageAvailable}from"./storage-available.js";
9
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,39 +1,2 @@
1
- 'use strict';
2
-
3
- class InvariantError extends Error {
4
- constructor(message) {
5
- super(message);
6
- this.name = 'InvariantError';
7
- }
8
- }
9
- function isInvariantError(error) {
10
- return error instanceof InvariantError;
11
- }
12
-
13
- /**
14
- * @throws {InvariantError}
15
- */
16
- function invariant(condition, message) {
17
- if (!condition) {
18
- throw new InvariantError(typeof message === 'function' ? message() : message);
19
- }
20
- }
21
-
22
- /**
23
- * @throws {Response}
24
- */
25
- function invariantResponse(condition, message, responseInit) {
26
- if (!condition) {
27
- // eslint-disable-next-line @typescript-eslint/only-throw-error
28
- throw new Response(typeof message === 'function' ? message() : message, {
29
- status: 400,
30
- ...responseInit
31
- });
32
- }
33
- }
34
-
35
- exports.InvariantError = InvariantError;
36
- exports.invariant = invariant;
37
- exports.invariantResponse = invariantResponse;
38
- exports.isInvariantError = isInvariantError;
1
+ "use strict";class InvariantError extends Error{constructor(message){super(message);this.name="InvariantError"}}function isInvariantError(error){return error instanceof InvariantError}function invariant(condition,message){if(!condition){throw new InvariantError(typeof message==="function"?message():message)}}function invariantResponse(condition,message,responseInit){if(!condition){throw new Response(typeof message==="function"?message():message,{status:400,...responseInit})}}exports.InvariantError=InvariantError;exports.invariant=invariant;exports.invariantResponse=invariantResponse;exports.isInvariantError=isInvariantError;
39
2
  //# sourceMappingURL=invariant.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"invariant.cjs","sources":["../src/invariant.ts"],"sourcesContent":["export class InvariantError extends Error {\n constructor(message: string) {\n super(message);\n\n this.name = 'InvariantError';\n }\n}\n\nexport function isInvariantError(error: unknown): error is InvariantError {\n return error instanceof InvariantError;\n}\n\n/**\n * @throws {InvariantError}\n */\nexport function invariant(condition: unknown, message: string | (() => string)): asserts condition {\n if (!condition) {\n throw new InvariantError(typeof message === 'function' ? message() : message);\n }\n}\n\n/**\n * @throws {Response}\n */\nexport function invariantResponse(\n condition: unknown,\n message: string | (() => string),\n responseInit?: ResponseInit,\n): asserts condition {\n if (!condition) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw new Response(typeof message === 'function' ? message() : message, {\n status: 400,\n ...responseInit,\n });\n }\n}\n"],"names":["InvariantError","Error","constructor","message","name","isInvariantError","error","invariant","condition","invariantResponse","responseInit","Response","status"],"mappings":";;AAAO,MAAMA,cAAc,SAASC,KAAK,CAAC;EACxCC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IAEd,IAAI,CAACC,IAAI,GAAG,gBAAgB;AAC9B,EAAA;AACF;AAEO,SAASC,gBAAgBA,CAACC,KAAc,EAA2B;EACxE,OAAOA,KAAK,YAAYN,cAAc;AACxC;;AAEA;AACA;AACA;AACO,SAASO,SAASA,CAACC,SAAkB,EAAEL,OAAgC,EAAqB;EACjG,IAAI,CAACK,SAAS,EAAE;AACd,IAAA,MAAM,IAAIR,cAAc,CAAC,OAAOG,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OAAO,CAAC;AAC/E,EAAA;AACF;;AAEA;AACA;AACA;AACO,SAASM,iBAAiBA,CAC/BD,SAAkB,EAClBL,OAAgC,EAChCO,YAA2B,EACR;EACnB,IAAI,CAACF,SAAS,EAAE;AACd;AACA,IAAA,MAAM,IAAIG,QAAQ,CAAC,OAAOR,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OAAO,EAAE;AACtES,MAAAA,MAAM,EAAE,GAAG;MACX,GAAGF;AACL,KAAC,CAAC;AACJ,EAAA;AACF;;;;;"}
1
+ {"version":3,"file":"invariant.cjs","sources":["../src/invariant.ts"],"sourcesContent":["export class InvariantError extends Error {\n public constructor(message: string) {\n super(message);\n\n this.name = 'InvariantError';\n }\n}\n\nexport function isInvariantError(error: unknown): error is InvariantError {\n return error instanceof InvariantError;\n}\n\n/**\n * @throws {InvariantError}\n */\nexport function invariant(condition: unknown, message: (() => string) | string): asserts condition {\n if (!condition) {\n throw new InvariantError(typeof message === 'function' ? message() : message);\n }\n}\n\n/**\n * @throws {Response}\n */\nexport function invariantResponse(\n condition: unknown,\n message: (() => string) | string,\n responseInit?: ResponseInit,\n): asserts condition {\n if (!condition) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw new Response(typeof message === 'function' ? message() : message, {\n status: 400,\n ...responseInit,\n });\n }\n}\n"],"names":["InvariantError","Error","constructor","message","super","this","name","isInvariantError","error","invariant","condition","invariantResponse","responseInit","Response","status"],"mappings":"aAAO,MAAMA,uBAAuBC,MAC3BC,WAAAA,CAAYC,SACjBC,MAAMD,SAENE,KAAKC,KAAO,gBACd,EAGK,SAASC,iBAAiBC,OAC/B,OAAOA,iBAAiBR,cAC1B,CAKO,SAASS,UAAUC,UAAoBP,SAC5C,IAAKO,UAAW,CACd,MAAM,IAAIV,sBAAsBG,UAAY,WAAaA,UAAYA,QACvE,CACF,CAKO,SAASQ,kBACdD,UACAP,QACAS,cAEA,IAAKF,UAAW,CAEd,MAAM,IAAIG,gBAAgBV,UAAY,WAAaA,UAAYA,QAAS,CACtEW,OAAQ,OACLF,cAEP,CACF"}
@@ -5,10 +5,10 @@ declare function isInvariantError(error: unknown): error is InvariantError;
5
5
  /**
6
6
  * @throws {InvariantError}
7
7
  */
8
- declare function invariant(condition: unknown, message: string | (() => string)): asserts condition;
8
+ declare function invariant(condition: unknown, message: (() => string) | string): asserts condition;
9
9
  /**
10
10
  * @throws {Response}
11
11
  */
12
- declare function invariantResponse(condition: unknown, message: string | (() => string), responseInit?: ResponseInit): asserts condition;
12
+ declare function invariantResponse(condition: unknown, message: (() => string) | string, responseInit?: ResponseInit): asserts condition;
13
13
 
14
14
  export { InvariantError, invariant, invariantResponse, isInvariantError };
@@ -5,10 +5,10 @@ declare function isInvariantError(error: unknown): error is InvariantError;
5
5
  /**
6
6
  * @throws {InvariantError}
7
7
  */
8
- declare function invariant(condition: unknown, message: string | (() => string)): asserts condition;
8
+ declare function invariant(condition: unknown, message: (() => string) | string): asserts condition;
9
9
  /**
10
10
  * @throws {Response}
11
11
  */
12
- declare function invariantResponse(condition: unknown, message: string | (() => string), responseInit?: ResponseInit): asserts condition;
12
+ declare function invariantResponse(condition: unknown, message: (() => string) | string, responseInit?: ResponseInit): asserts condition;
13
13
 
14
14
  export { InvariantError, invariant, invariantResponse, isInvariantError };
package/dist/invariant.js CHANGED
@@ -1,34 +1,2 @@
1
- class InvariantError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = 'InvariantError';
5
- }
6
- }
7
- function isInvariantError(error) {
8
- return error instanceof InvariantError;
9
- }
10
-
11
- /**
12
- * @throws {InvariantError}
13
- */
14
- function invariant(condition, message) {
15
- if (!condition) {
16
- throw new InvariantError(typeof message === 'function' ? message() : message);
17
- }
18
- }
19
-
20
- /**
21
- * @throws {Response}
22
- */
23
- function invariantResponse(condition, message, responseInit) {
24
- if (!condition) {
25
- // eslint-disable-next-line @typescript-eslint/only-throw-error
26
- throw new Response(typeof message === 'function' ? message() : message, {
27
- status: 400,
28
- ...responseInit
29
- });
30
- }
31
- }
32
-
33
- export { InvariantError, invariant, invariantResponse, isInvariantError };
1
+ class InvariantError extends Error{constructor(message){super(message);this.name="InvariantError"}}function isInvariantError(error){return error instanceof InvariantError}function invariant(condition,message){if(!condition){throw new InvariantError(typeof message==="function"?message():message)}}function invariantResponse(condition,message,responseInit){if(!condition){throw new Response(typeof message==="function"?message():message,{status:400,...responseInit})}}export{InvariantError,invariant,invariantResponse,isInvariantError};
34
2
  //# sourceMappingURL=invariant.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"invariant.js","sources":["../src/invariant.ts"],"sourcesContent":["export class InvariantError extends Error {\n constructor(message: string) {\n super(message);\n\n this.name = 'InvariantError';\n }\n}\n\nexport function isInvariantError(error: unknown): error is InvariantError {\n return error instanceof InvariantError;\n}\n\n/**\n * @throws {InvariantError}\n */\nexport function invariant(condition: unknown, message: string | (() => string)): asserts condition {\n if (!condition) {\n throw new InvariantError(typeof message === 'function' ? message() : message);\n }\n}\n\n/**\n * @throws {Response}\n */\nexport function invariantResponse(\n condition: unknown,\n message: string | (() => string),\n responseInit?: ResponseInit,\n): asserts condition {\n if (!condition) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw new Response(typeof message === 'function' ? message() : message, {\n status: 400,\n ...responseInit,\n });\n }\n}\n"],"names":["InvariantError","Error","constructor","message","name","isInvariantError","error","invariant","condition","invariantResponse","responseInit","Response","status"],"mappings":"AAAO,MAAMA,cAAc,SAASC,KAAK,CAAC;EACxCC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IAEd,IAAI,CAACC,IAAI,GAAG,gBAAgB;AAC9B,EAAA;AACF;AAEO,SAASC,gBAAgBA,CAACC,KAAc,EAA2B;EACxE,OAAOA,KAAK,YAAYN,cAAc;AACxC;;AAEA;AACA;AACA;AACO,SAASO,SAASA,CAACC,SAAkB,EAAEL,OAAgC,EAAqB;EACjG,IAAI,CAACK,SAAS,EAAE;AACd,IAAA,MAAM,IAAIR,cAAc,CAAC,OAAOG,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OAAO,CAAC;AAC/E,EAAA;AACF;;AAEA;AACA;AACA;AACO,SAASM,iBAAiBA,CAC/BD,SAAkB,EAClBL,OAAgC,EAChCO,YAA2B,EACR;EACnB,IAAI,CAACF,SAAS,EAAE;AACd;AACA,IAAA,MAAM,IAAIG,QAAQ,CAAC,OAAOR,OAAO,KAAK,UAAU,GAAGA,OAAO,EAAE,GAAGA,OAAO,EAAE;AACtES,MAAAA,MAAM,EAAE,GAAG;MACX,GAAGF;AACL,KAAC,CAAC;AACJ,EAAA;AACF;;"}
1
+ {"version":3,"file":"invariant.js","sources":["../src/invariant.ts"],"sourcesContent":["export class InvariantError extends Error {\n public constructor(message: string) {\n super(message);\n\n this.name = 'InvariantError';\n }\n}\n\nexport function isInvariantError(error: unknown): error is InvariantError {\n return error instanceof InvariantError;\n}\n\n/**\n * @throws {InvariantError}\n */\nexport function invariant(condition: unknown, message: (() => string) | string): asserts condition {\n if (!condition) {\n throw new InvariantError(typeof message === 'function' ? message() : message);\n }\n}\n\n/**\n * @throws {Response}\n */\nexport function invariantResponse(\n condition: unknown,\n message: (() => string) | string,\n responseInit?: ResponseInit,\n): asserts condition {\n if (!condition) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw new Response(typeof message === 'function' ? message() : message, {\n status: 400,\n ...responseInit,\n });\n }\n}\n"],"names":["InvariantError","Error","constructor","message","super","this","name","isInvariantError","error","invariant","condition","invariantResponse","responseInit","Response","status"],"mappings":"AAAO,MAAMA,uBAAuBC,MAC3BC,WAAAA,CAAYC,SACjBC,MAAMD,SAENE,KAAKC,KAAO,gBACd,EAGK,SAASC,iBAAiBC,OAC/B,OAAOA,iBAAiBR,cAC1B,CAKO,SAASS,UAAUC,UAAoBP,SAC5C,IAAKO,UAAW,CACd,MAAM,IAAIV,sBAAsBG,UAAY,WAAaA,UAAYA,QACvE,CACF,CAKO,SAASQ,kBACdD,UACAP,QACAS,cAEA,IAAKF,UAAW,CAEd,MAAM,IAAIG,gBAAgBV,UAAY,WAAaA,UAAYA,QAAS,CACtEW,OAAQ,OACLF,cAEP,CACF"}
package/dist/is-nil.cjs CHANGED
@@ -1,8 +1,2 @@
1
- 'use strict';
2
-
3
- function isNil(value) {
4
- return value == null;
5
- }
6
-
7
- exports.isNil = isNil;
1
+ "use strict";function isNil(value){return value==null}exports.isNil=isNil;
8
2
  //# sourceMappingURL=is-nil.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-nil.cjs","sources":["../src/is-nil.ts"],"sourcesContent":["export function isNil(value: unknown): value is null | undefined {\n return value == null;\n}\n"],"names":["isNil","value"],"mappings":";;AAAO,SAASA,KAAKA,CAACC,KAAc,EAA6B;EAC/D,OAAOA,KAAK,IAAI,IAAI;AACtB;;"}
1
+ {"version":3,"file":"is-nil.cjs","sources":["../src/is-nil.ts"],"sourcesContent":["export function isNil(value: unknown): value is null | undefined {\n return value == null;\n}\n"],"names":["isNil","value"],"mappings":"aAAO,SAASA,MAAMC,OACpB,OAAOA,OAAS,IAClB"}
package/dist/is-nil.js CHANGED
@@ -1,6 +1,2 @@
1
- function isNil(value) {
2
- return value == null;
3
- }
4
-
5
- export { isNil };
1
+ function isNil(value){return value==null}export{isNil};
6
2
  //# sourceMappingURL=is-nil.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-nil.js","sources":["../src/is-nil.ts"],"sourcesContent":["export function isNil(value: unknown): value is null | undefined {\n return value == null;\n}\n"],"names":["isNil","value"],"mappings":"AAAO,SAASA,KAAKA,CAACC,KAAc,EAA6B;EAC/D,OAAOA,KAAK,IAAI,IAAI;AACtB;;"}
1
+ {"version":3,"file":"is-nil.js","sources":["../src/is-nil.ts"],"sourcesContent":["export function isNil(value: unknown): value is null | undefined {\n return value == null;\n}\n"],"names":["isNil","value"],"mappings":"AAAO,SAASA,MAAMC,OACpB,OAAOA,OAAS,IAClB"}
@@ -1,8 +1,2 @@
1
- 'use strict';
2
-
3
- function isObjectLike(value) {
4
- return typeof value === 'object' && value !== null;
5
- }
6
-
7
- exports.isObjectLike = isObjectLike;
1
+ "use strict";function isObjectLike(value){return typeof value==="object"&&value!==null}exports.isObjectLike=isObjectLike;
8
2
  //# sourceMappingURL=is-object-like.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-object-like.cjs","sources":["../src/is-object-like.ts"],"sourcesContent":["export function isObjectLike(value: unknown): value is object {\n return typeof value === 'object' && value !== null;\n}\n"],"names":["isObjectLike","value"],"mappings":";;AAAO,SAASA,YAAYA,CAACC,KAAc,EAAmB;AAC5D,EAAA,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI;AACpD;;"}
1
+ {"version":3,"file":"is-object-like.cjs","sources":["../src/is-object-like.ts"],"sourcesContent":["export function isObjectLike(value: unknown): value is object {\n return typeof value === 'object' && value !== null;\n}\n"],"names":["isObjectLike","value"],"mappings":"aAAO,SAASA,aAAaC,OAC3B,cAAcA,QAAU,UAAYA,QAAU,IAChD"}
@@ -1,6 +1,2 @@
1
- function isObjectLike(value) {
2
- return typeof value === 'object' && value !== null;
3
- }
4
-
5
- export { isObjectLike };
1
+ function isObjectLike(value){return typeof value==="object"&&value!==null}export{isObjectLike};
6
2
  //# sourceMappingURL=is-object-like.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-object-like.js","sources":["../src/is-object-like.ts"],"sourcesContent":["export function isObjectLike(value: unknown): value is object {\n return typeof value === 'object' && value !== null;\n}\n"],"names":["isObjectLike","value"],"mappings":"AAAO,SAASA,YAAYA,CAACC,KAAc,EAAmB;AAC5D,EAAA,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI;AACpD;;"}
1
+ {"version":3,"file":"is-object-like.js","sources":["../src/is-object-like.ts"],"sourcesContent":["export function isObjectLike(value: unknown): value is object {\n return typeof value === 'object' && value !== null;\n}\n"],"names":["isObjectLike","value"],"mappings":"AAAO,SAASA,aAAaC,OAC3B,cAAcA,QAAU,UAAYA,QAAU,IAChD"}
@@ -1,14 +1,2 @@
1
- 'use strict';
2
-
3
- var isObjectLike = require('./is-object-like.cjs');
4
-
5
- function isPlainObject(value) {
6
- if (!isObjectLike.isObjectLike(value)) {
7
- return false;
8
- }
9
- const prototype = Object.getPrototypeOf(value);
10
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
11
- }
12
-
13
- exports.isPlainObject = isPlainObject;
1
+ "use strict";var isObjectLike=require("./is-object-like.cjs");function isPlainObject(value){if(!isObjectLike.isObjectLike(value)){return false}const prototype=Object.getPrototypeOf(value);return(prototype===null||prototype===Object.prototype||Object.getPrototypeOf(prototype)===null)&&!(Symbol.toStringTag in value)&&!(Symbol.iterator in value)}exports.isPlainObject=isPlainObject;
14
2
  //# sourceMappingURL=is-plain-object.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-plain-object.cjs","sources":["../src/is-plain-object.ts"],"sourcesContent":["import { isObjectLike } from './is-object-like';\n\nexport function isPlainObject(value: unknown): value is object {\n if (!isObjectLike(value)) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value);\n\n return (\n (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) &&\n !(Symbol.toStringTag in value) &&\n !(Symbol.iterator in value)\n );\n}\n"],"names":["isPlainObject","value","isObjectLike","prototype","Object","getPrototypeOf","Symbol","toStringTag","iterator"],"mappings":";;;;AAEO,SAASA,aAAaA,CAACC,KAAc,EAAmB;AAC7D,EAAA,IAAI,CAACC,yBAAY,CAACD,KAAK,CAAC,EAAE;AACxB,IAAA,OAAO,KAAK;AACd,EAAA;AAEA,EAAA,MAAME,SAAS,GAAGC,MAAM,CAACC,cAAc,CAACJ,KAAK,CAAC;AAE9C,EAAA,OACE,CAACE,SAAS,KAAK,IAAI,IAAIA,SAAS,KAAKC,MAAM,CAACD,SAAS,IAAIC,MAAM,CAACC,cAAc,CAACF,SAAS,CAAC,KAAK,IAAI,KAClG,EAAEG,MAAM,CAACC,WAAW,IAAIN,KAAK,CAAC,IAC9B,EAAEK,MAAM,CAACE,QAAQ,IAAIP,KAAK,CAAC;AAE/B;;"}
1
+ {"version":3,"file":"is-plain-object.cjs","sources":["../src/is-plain-object.ts"],"sourcesContent":["import { isObjectLike } from './is-object-like';\n\nexport function isPlainObject(value: unknown): value is object {\n if (!isObjectLike(value)) {\n return false;\n }\n\n const prototype: unknown = Object.getPrototypeOf(value);\n\n return (\n (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) &&\n !(Symbol.toStringTag in value) &&\n !(Symbol.iterator in value)\n );\n}\n"],"names":["isPlainObject","value","isObjectLike","prototype","Object","getPrototypeOf","Symbol","toStringTag","iterator"],"mappings":"8DAEO,SAASA,cAAcC,OAC5B,IAAKC,aAAAA,aAAaD,OAAQ,CACxB,OAAO,KACT,CAEA,MAAME,UAAqBC,OAAOC,eAAeJ,OAEjD,OACGE,YAAc,MAAQA,YAAcC,OAAOD,WAAaC,OAAOC,eAAeF,aAAe,SAC5FG,OAAOC,eAAeN,UACtBK,OAAOE,YAAYP,MAEzB"}
@@ -1,12 +1,2 @@
1
- import { isObjectLike } from './is-object-like.js';
2
-
3
- function isPlainObject(value) {
4
- if (!isObjectLike(value)) {
5
- return false;
6
- }
7
- const prototype = Object.getPrototypeOf(value);
8
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
9
- }
10
-
11
- export { isPlainObject };
1
+ import{isObjectLike}from"./is-object-like.js";function isPlainObject(value){if(!isObjectLike(value)){return false}const prototype=Object.getPrototypeOf(value);return(prototype===null||prototype===Object.prototype||Object.getPrototypeOf(prototype)===null)&&!(Symbol.toStringTag in value)&&!(Symbol.iterator in value)}export{isPlainObject};
12
2
  //# sourceMappingURL=is-plain-object.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-plain-object.js","sources":["../src/is-plain-object.ts"],"sourcesContent":["import { isObjectLike } from './is-object-like';\n\nexport function isPlainObject(value: unknown): value is object {\n if (!isObjectLike(value)) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value);\n\n return (\n (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) &&\n !(Symbol.toStringTag in value) &&\n !(Symbol.iterator in value)\n );\n}\n"],"names":["isPlainObject","value","isObjectLike","prototype","Object","getPrototypeOf","Symbol","toStringTag","iterator"],"mappings":";;AAEO,SAASA,aAAaA,CAACC,KAAc,EAAmB;AAC7D,EAAA,IAAI,CAACC,YAAY,CAACD,KAAK,CAAC,EAAE;AACxB,IAAA,OAAO,KAAK;AACd,EAAA;AAEA,EAAA,MAAME,SAAS,GAAGC,MAAM,CAACC,cAAc,CAACJ,KAAK,CAAC;AAE9C,EAAA,OACE,CAACE,SAAS,KAAK,IAAI,IAAIA,SAAS,KAAKC,MAAM,CAACD,SAAS,IAAIC,MAAM,CAACC,cAAc,CAACF,SAAS,CAAC,KAAK,IAAI,KAClG,EAAEG,MAAM,CAACC,WAAW,IAAIN,KAAK,CAAC,IAC9B,EAAEK,MAAM,CAACE,QAAQ,IAAIP,KAAK,CAAC;AAE/B;;"}
1
+ {"version":3,"file":"is-plain-object.js","sources":["../src/is-plain-object.ts"],"sourcesContent":["import { isObjectLike } from './is-object-like';\n\nexport function isPlainObject(value: unknown): value is object {\n if (!isObjectLike(value)) {\n return false;\n }\n\n const prototype: unknown = Object.getPrototypeOf(value);\n\n return (\n (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) &&\n !(Symbol.toStringTag in value) &&\n !(Symbol.iterator in value)\n );\n}\n"],"names":["isPlainObject","value","isObjectLike","prototype","Object","getPrototypeOf","Symbol","toStringTag","iterator"],"mappings":"8CAEO,SAASA,cAAcC,OAC5B,IAAKC,aAAaD,OAAQ,CACxB,OAAO,KACT,CAEA,MAAME,UAAqBC,OAAOC,eAAeJ,OAEjD,OACGE,YAAc,MAAQA,YAAcC,OAAOD,WAAaC,OAAOC,eAAeF,aAAe,SAC5FG,OAAOC,eAAeN,UACtBK,OAAOE,YAAYP,MAEzB"}
package/dist/remember.cjs CHANGED
@@ -1,15 +1,2 @@
1
- 'use strict';
2
-
3
- function remember(name, getValue) {
4
- const ctx = globalThis;
5
- if (!ctx.__remember) {
6
- ctx.__remember = new Map();
7
- }
8
- if (!ctx.__remember.has(name)) {
9
- ctx.__remember.set(name, getValue());
10
- }
11
- return ctx.__remember.get(name);
12
- }
13
-
14
- exports.remember = remember;
1
+ "use strict";function remember(name,getValue){const ctx=globalThis;ctx.__remember??(ctx.__remember=new Map);if(!ctx.__remember.has(name)){ctx.__remember.set(name,getValue())}return ctx.__remember.get(name)}exports.remember=remember;
15
2
  //# sourceMappingURL=remember.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"remember.cjs","sources":["../src/remember.ts"],"sourcesContent":["declare namespace globalThis {\n // eslint-disable-next-line no-var\n var __remember: Map<string, any> | undefined;\n}\n\nexport function remember<T>(name: string, getValue: () => T): T {\n const ctx = globalThis;\n\n if (!ctx.__remember) {\n ctx.__remember = new Map();\n }\n\n if (!ctx.__remember.has(name)) {\n ctx.__remember.set(name, getValue());\n }\n\n return ctx.__remember.get(name) as T;\n}\n"],"names":["remember","name","getValue","ctx","globalThis","__remember","Map","has","set","get"],"mappings":";;AAKO,SAASA,QAAQA,CAAIC,IAAY,EAAEC,QAAiB,EAAK;EAC9D,MAAMC,GAAG,GAAGC,UAAU;AAEtB,EAAA,IAAI,CAACD,GAAG,CAACE,UAAU,EAAE;AACnBF,IAAAA,GAAG,CAACE,UAAU,GAAG,IAAIC,GAAG,EAAE;AAC5B,EAAA;EAEA,IAAI,CAACH,GAAG,CAACE,UAAU,CAACE,GAAG,CAACN,IAAI,CAAC,EAAE;IAC7BE,GAAG,CAACE,UAAU,CAACG,GAAG,CAACP,IAAI,EAAEC,QAAQ,EAAE,CAAC;AACtC,EAAA;AAEA,EAAA,OAAOC,GAAG,CAACE,UAAU,CAACI,GAAG,CAACR,IAAI,CAAC;AACjC;;"}
1
+ {"version":3,"file":"remember.cjs","sources":["../src/remember.ts"],"sourcesContent":["export function remember<T>(name: string, getValue: () => T): T {\n const ctx = globalThis as { __remember?: Map<string, unknown> };\n\n ctx.__remember ??= new Map();\n\n if (!ctx.__remember.has(name)) {\n ctx.__remember.set(name, getValue());\n }\n\n return ctx.__remember.get(name) as T;\n}\n"],"names":["remember","name","getValue","ctx","globalThis","__remember","Map","has","set","get"],"mappings":"aAAO,SAASA,SAAYC,KAAcC,UACxC,MAAMC,IAAMC,WAEZD,IAAIE,aAAJF,IAAIE,WAAe,IAAIC,KAEvB,IAAKH,IAAIE,WAAWE,IAAIN,MAAO,CAC7BE,IAAIE,WAAWG,IAAIP,KAAMC,WAC3B,CAEA,OAAOC,IAAIE,WAAWI,IAAIR,KAC5B"}
package/dist/remember.js CHANGED
@@ -1,13 +1,2 @@
1
- function remember(name, getValue) {
2
- const ctx = globalThis;
3
- if (!ctx.__remember) {
4
- ctx.__remember = new Map();
5
- }
6
- if (!ctx.__remember.has(name)) {
7
- ctx.__remember.set(name, getValue());
8
- }
9
- return ctx.__remember.get(name);
10
- }
11
-
12
- export { remember };
1
+ function remember(name,getValue){const ctx=globalThis;ctx.__remember??(ctx.__remember=new Map);if(!ctx.__remember.has(name)){ctx.__remember.set(name,getValue())}return ctx.__remember.get(name)}export{remember};
13
2
  //# sourceMappingURL=remember.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remember.js","sources":["../src/remember.ts"],"sourcesContent":["declare namespace globalThis {\n // eslint-disable-next-line no-var\n var __remember: Map<string, any> | undefined;\n}\n\nexport function remember<T>(name: string, getValue: () => T): T {\n const ctx = globalThis;\n\n if (!ctx.__remember) {\n ctx.__remember = new Map();\n }\n\n if (!ctx.__remember.has(name)) {\n ctx.__remember.set(name, getValue());\n }\n\n return ctx.__remember.get(name) as T;\n}\n"],"names":["remember","name","getValue","ctx","globalThis","__remember","Map","has","set","get"],"mappings":"AAKO,SAASA,QAAQA,CAAIC,IAAY,EAAEC,QAAiB,EAAK;EAC9D,MAAMC,GAAG,GAAGC,UAAU;AAEtB,EAAA,IAAI,CAACD,GAAG,CAACE,UAAU,EAAE;AACnBF,IAAAA,GAAG,CAACE,UAAU,GAAG,IAAIC,GAAG,EAAE;AAC5B,EAAA;EAEA,IAAI,CAACH,GAAG,CAACE,UAAU,CAACE,GAAG,CAACN,IAAI,CAAC,EAAE;IAC7BE,GAAG,CAACE,UAAU,CAACG,GAAG,CAACP,IAAI,EAAEC,QAAQ,EAAE,CAAC;AACtC,EAAA;AAEA,EAAA,OAAOC,GAAG,CAACE,UAAU,CAACI,GAAG,CAACR,IAAI,CAAC;AACjC;;"}
1
+ {"version":3,"file":"remember.js","sources":["../src/remember.ts"],"sourcesContent":["export function remember<T>(name: string, getValue: () => T): T {\n const ctx = globalThis as { __remember?: Map<string, unknown> };\n\n ctx.__remember ??= new Map();\n\n if (!ctx.__remember.has(name)) {\n ctx.__remember.set(name, getValue());\n }\n\n return ctx.__remember.get(name) as T;\n}\n"],"names":["remember","name","getValue","ctx","globalThis","__remember","Map","has","set","get"],"mappings":"AAAO,SAASA,SAAYC,KAAcC,UACxC,MAAMC,IAAMC,WAEZD,IAAIE,aAAJF,IAAIE,WAAe,IAAIC,KAEvB,IAAKH,IAAIE,WAAWE,IAAIN,MAAO,CAC7BE,IAAIE,WAAWG,IAAIP,KAAMC,WAC3B,CAEA,OAAOC,IAAIE,WAAWI,IAAIR,KAC5B"}
@@ -1,20 +1,2 @@
1
- 'use strict';
2
-
3
- /**
4
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage MDN}
5
- */
6
- function storageAvailable(type) {
7
- let storage;
8
- try {
9
- storage = window[type];
10
- const x = `__${type}__`;
11
- storage.setItem(x, x);
12
- storage.removeItem(x);
13
- return true;
14
- } catch (e) {
15
- return e instanceof DOMException && e.name === 'QuotaExceededError' && !!storage && storage.length !== 0;
16
- }
17
- }
18
-
19
- exports.storageAvailable = storageAvailable;
1
+ "use strict";function storageAvailable(type){let storage;try{storage=window[type];const x=`__${type}__`;storage.setItem(x,x);storage.removeItem(x);return true}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&!!storage&&storage.length!==0}}exports.storageAvailable=storageAvailable;
20
2
  //# sourceMappingURL=storage-available.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-available.cjs","sources":["../src/storage-available.ts"],"sourcesContent":["/**\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage MDN}\n */\nexport function storageAvailable(type: 'localStorage' | 'sessionStorage'): boolean {\n let storage;\n\n try {\n storage = window[type];\n\n const x = `__${type}__`;\n storage.setItem(x, x);\n storage.removeItem(x);\n\n return true;\n } catch (e) {\n return e instanceof DOMException && e.name === 'QuotaExceededError' && !!storage && storage.length !== 0;\n }\n}\n"],"names":["storageAvailable","type","storage","window","x","setItem","removeItem","e","DOMException","name","length"],"mappings":";;AAAA;AACA;AACA;AACO,SAASA,gBAAgBA,CAACC,IAAuC,EAAW;AACjF,EAAA,IAAIC,OAAO;EAEX,IAAI;AACFA,IAAAA,OAAO,GAAGC,MAAM,CAACF,IAAI,CAAC;AAEtB,IAAA,MAAMG,CAAC,GAAG,CAAA,EAAA,EAAKH,IAAI,CAAA,EAAA,CAAI;AACvBC,IAAAA,OAAO,CAACG,OAAO,CAACD,CAAC,EAAEA,CAAC,CAAC;AACrBF,IAAAA,OAAO,CAACI,UAAU,CAACF,CAAC,CAAC;AAErB,IAAA,OAAO,IAAI;EACb,CAAC,CAAC,OAAOG,CAAC,EAAE;AACV,IAAA,OAAOA,CAAC,YAAYC,YAAY,IAAID,CAAC,CAACE,IAAI,KAAK,oBAAoB,IAAI,CAAC,CAACP,OAAO,IAAIA,OAAO,CAACQ,MAAM,KAAK,CAAC;AAC1G,EAAA;AACF;;"}
1
+ {"version":3,"file":"storage-available.cjs","sources":["../src/storage-available.ts"],"sourcesContent":["/**\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage MDN}\n */\nexport function storageAvailable(type: 'localStorage' | 'sessionStorage'): boolean {\n let storage;\n\n try {\n storage = window[type];\n\n const x = `__${type}__`;\n storage.setItem(x, x);\n storage.removeItem(x);\n\n return true;\n } catch (e) {\n return e instanceof DOMException && e.name === 'QuotaExceededError' && !!storage && storage.length !== 0;\n }\n}\n"],"names":["storageAvailable","type","storage","window","x","setItem","removeItem","e","DOMException","name","length"],"mappings":"aAGO,SAASA,iBAAiBC,MAC/B,IAAIC,QAEJ,IACEA,QAAUC,OAAOF,MAEjB,MAAMG,EAAI,KAAKH,SACfC,QAAQG,QAAQD,EAAGA,GACnBF,QAAQI,WAAWF,GAEnB,OAAO,IACT,CAAE,MAAOG,GACP,OAAOA,aAAaC,cAAgBD,EAAEE,OAAS,wBAA0BP,SAAWA,QAAQQ,SAAW,CACzG,CACF"}
@@ -1,18 +1,2 @@
1
- /**
2
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage MDN}
3
- */
4
- function storageAvailable(type) {
5
- let storage;
6
- try {
7
- storage = window[type];
8
- const x = `__${type}__`;
9
- storage.setItem(x, x);
10
- storage.removeItem(x);
11
- return true;
12
- } catch (e) {
13
- return e instanceof DOMException && e.name === 'QuotaExceededError' && !!storage && storage.length !== 0;
14
- }
15
- }
16
-
17
- export { storageAvailable };
1
+ function storageAvailable(type){let storage;try{storage=window[type];const x=`__${type}__`;storage.setItem(x,x);storage.removeItem(x);return true}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&!!storage&&storage.length!==0}}export{storageAvailable};
18
2
  //# sourceMappingURL=storage-available.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-available.js","sources":["../src/storage-available.ts"],"sourcesContent":["/**\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage MDN}\n */\nexport function storageAvailable(type: 'localStorage' | 'sessionStorage'): boolean {\n let storage;\n\n try {\n storage = window[type];\n\n const x = `__${type}__`;\n storage.setItem(x, x);\n storage.removeItem(x);\n\n return true;\n } catch (e) {\n return e instanceof DOMException && e.name === 'QuotaExceededError' && !!storage && storage.length !== 0;\n }\n}\n"],"names":["storageAvailable","type","storage","window","x","setItem","removeItem","e","DOMException","name","length"],"mappings":"AAAA;AACA;AACA;AACO,SAASA,gBAAgBA,CAACC,IAAuC,EAAW;AACjF,EAAA,IAAIC,OAAO;EAEX,IAAI;AACFA,IAAAA,OAAO,GAAGC,MAAM,CAACF,IAAI,CAAC;AAEtB,IAAA,MAAMG,CAAC,GAAG,CAAA,EAAA,EAAKH,IAAI,CAAA,EAAA,CAAI;AACvBC,IAAAA,OAAO,CAACG,OAAO,CAACD,CAAC,EAAEA,CAAC,CAAC;AACrBF,IAAAA,OAAO,CAACI,UAAU,CAACF,CAAC,CAAC;AAErB,IAAA,OAAO,IAAI;EACb,CAAC,CAAC,OAAOG,CAAC,EAAE;AACV,IAAA,OAAOA,CAAC,YAAYC,YAAY,IAAID,CAAC,CAACE,IAAI,KAAK,oBAAoB,IAAI,CAAC,CAACP,OAAO,IAAIA,OAAO,CAACQ,MAAM,KAAK,CAAC;AAC1G,EAAA;AACF;;"}
1
+ {"version":3,"file":"storage-available.js","sources":["../src/storage-available.ts"],"sourcesContent":["/**\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage MDN}\n */\nexport function storageAvailable(type: 'localStorage' | 'sessionStorage'): boolean {\n let storage;\n\n try {\n storage = window[type];\n\n const x = `__${type}__`;\n storage.setItem(x, x);\n storage.removeItem(x);\n\n return true;\n } catch (e) {\n return e instanceof DOMException && e.name === 'QuotaExceededError' && !!storage && storage.length !== 0;\n }\n}\n"],"names":["storageAvailable","type","storage","window","x","setItem","removeItem","e","DOMException","name","length"],"mappings":"AAGO,SAASA,iBAAiBC,MAC/B,IAAIC,QAEJ,IACEA,QAAUC,OAAOF,MAEjB,MAAMG,EAAI,KAAKH,SACfC,QAAQG,QAAQD,EAAGA,GACnBF,QAAQI,WAAWF,GAEnB,OAAO,IACT,CAAE,MAAOG,GACP,OAAOA,aAAaC,cAAgBD,EAAEE,OAAS,wBAA0BP,SAAWA,QAAQQ,SAAW,CACzG,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mado/utils",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "homepage": "https://github.com/doinki/mado/tree/main/packages/mado-utils#readme",
5
5
  "bugs": "https://github.com/doinki/mado/issues",
6
6
  "license": "MIT",
@@ -39,11 +39,11 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@babel/runtime": "^7.29.10"
42
+ "@babel/runtime": "^7.29.15"
43
43
  },
44
44
  "devDependencies": {
45
- "@vitest/coverage-istanbul": "^5.0.5",
46
- "happy-dom": "^21.0.3"
45
+ "@vitest/coverage-istanbul": "^5.1.1",
46
+ "happy-dom": "^21.0.4"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "rimraf dist && rollup -c --environment NODE_ENV:production",