@mado/utils 0.4.0 → 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 -9
  2. package/dist/capitalize.cjs.map +1 -1
  3. package/dist/capitalize.js +1 -7
  4. package/dist/capitalize.js.map +1 -1
  5. package/dist/debounce.cjs +1 -19
  6. package/dist/debounce.cjs.map +1 -1
  7. package/dist/debounce.d.cts +4 -2
  8. package/dist/debounce.d.ts +4 -2
  9. package/dist/debounce.js +1 -17
  10. package/dist/debounce.js.map +1 -1
  11. package/dist/index.cjs +1 -62
  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 -9
  16. package/dist/index.js.map +1 -1
  17. package/dist/invariant.cjs +1 -31
  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 -26
  22. package/dist/invariant.js.map +1 -1
  23. package/dist/is-nil.cjs +1 -9
  24. package/dist/is-nil.cjs.map +1 -1
  25. package/dist/is-nil.js +1 -7
  26. package/dist/is-nil.js.map +1 -1
  27. package/dist/is-object-like.cjs +1 -9
  28. package/dist/is-object-like.cjs.map +1 -1
  29. package/dist/is-object-like.js +1 -7
  30. package/dist/is-object-like.js.map +1 -1
  31. package/dist/is-plain-object.cjs +1 -15
  32. package/dist/is-plain-object.cjs.map +1 -1
  33. package/dist/is-plain-object.js +1 -13
  34. package/dist/is-plain-object.js.map +1 -1
  35. package/dist/remember.cjs +1 -16
  36. package/dist/remember.cjs.map +1 -1
  37. package/dist/remember.js +1 -14
  38. package/dist/remember.js.map +1 -1
  39. package/dist/storage-available.cjs +1 -18
  40. package/dist/storage-available.cjs.map +1 -1
  41. package/dist/storage-available.js +1 -16
  42. package/dist/storage-available.js.map +1 -1
  43. package/package.json +25 -19
@@ -1,10 +1,2 @@
1
- 'use strict';
2
-
3
- // src/capitalize.ts
4
- function capitalize(str) {
5
- return str.charAt(0).toUpperCase() + str.substring(1);
6
- }
7
-
8
- exports.capitalize = capitalize;
1
+ "use strict";function capitalize(str){return str.charAt(0).toUpperCase()+str.substring(1)}exports.capitalize=capitalize;
9
2
  //# sourceMappingURL=capitalize.cjs.map
10
- //# sourceMappingURL=capitalize.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/capitalize.ts"],"names":[],"mappings":";;;AAAO,SAAS,WAAW,GAAA,EAAqB;AAC9C,EAAA,OAAO,GAAA,CAAI,OAAO,CAAC,CAAA,CAAE,aAAY,GAAI,GAAA,CAAI,UAAU,CAAC,CAAA;AACtD","file":"capitalize.cjs","sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n"]}
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,8 +1,2 @@
1
- // src/capitalize.ts
2
- function capitalize(str) {
3
- return str.charAt(0).toUpperCase() + str.substring(1);
4
- }
5
-
6
- export { capitalize };
1
+ function capitalize(str){return str.charAt(0).toUpperCase()+str.substring(1)}export{capitalize};
7
2
  //# sourceMappingURL=capitalize.js.map
8
- //# sourceMappingURL=capitalize.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/capitalize.ts"],"names":[],"mappings":";AAAO,SAAS,WAAW,GAAA,EAAqB;AAC9C,EAAA,OAAO,GAAA,CAAI,OAAO,CAAC,CAAA,CAAE,aAAY,GAAI,GAAA,CAAI,UAAU,CAAC,CAAA;AACtD","file":"capitalize.js","sourcesContent":["export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n"]}
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,20 +1,2 @@
1
- 'use strict';
2
-
3
- // src/debounce.ts
4
- function debounce(func, wait = 166) {
5
- let timeout;
6
- function debounced(...args) {
7
- clearTimeout(timeout);
8
- timeout = setTimeout(() => {
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
20
- //# sourceMappingURL=debounce.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/debounce.ts"],"names":[],"mappings":";;;AAIO,SAAS,QAAA,CAA4C,IAAA,EAAS,IAAA,GAAO,GAAA,EAAqB;AAC/F,EAAA,IAAI,OAAA;AAEJ,EAAA,SAAS,aAAa,IAAA,EAAqB;AACzC,IAAA,YAAA,CAAa,OAAO,CAAA;AAEpB,IAAA,OAAA,GAAU,WAAW,MAAM;AAEzB,MAAA,IAAA,CAAK,KAAA,CAAM,MAAM,IAAI,CAAA;AAAA,IACvB,GAAG,IAAI,CAAA;AAAA,EACT;AAEA,EAAA,SAAA,CAAU,SAAS,MAAM;AACvB,IAAA,YAAA,CAAa,OAAO,CAAA;AAAA,EACtB,CAAA;AAEA,EAAA,OAAO,SAAA;AACT","file":"debounce.cjs","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"]}
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,6 +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
- export { type Cancelable, debounce };
7
+ export { debounce };
8
+ export type { Cancelable, Debounced };
@@ -1,6 +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
- export { type Cancelable, debounce };
7
+ export { debounce };
8
+ export type { Cancelable, Debounced };
package/dist/debounce.js CHANGED
@@ -1,18 +1,2 @@
1
- // src/debounce.ts
2
- function debounce(func, wait = 166) {
3
- let timeout;
4
- function debounced(...args) {
5
- clearTimeout(timeout);
6
- timeout = setTimeout(() => {
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
18
- //# sourceMappingURL=debounce.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/debounce.ts"],"names":[],"mappings":";AAIO,SAAS,QAAA,CAA4C,IAAA,EAAS,IAAA,GAAO,GAAA,EAAqB;AAC/F,EAAA,IAAI,OAAA;AAEJ,EAAA,SAAS,aAAa,IAAA,EAAqB;AACzC,IAAA,YAAA,CAAa,OAAO,CAAA;AAEpB,IAAA,OAAA,GAAU,WAAW,MAAM;AAEzB,MAAA,IAAA,CAAK,KAAA,CAAM,MAAM,IAAI,CAAA;AAAA,IACvB,GAAG,IAAI,CAAA;AAAA,EACT;AAEA,EAAA,SAAA,CAAU,SAAS,MAAM;AACvB,IAAA,YAAA,CAAa,OAAO,CAAA;AAAA,EACtB,CAAA;AAEA,EAAA,OAAO,SAAA;AACT","file":"debounce.js","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"]}
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,63 +1,2 @@
1
- 'use strict';
2
-
3
- var capitalize_cjs = require('./capitalize.cjs');
4
- var debounce_cjs = require('./debounce.cjs');
5
- var invariant_cjs = require('./invariant.cjs');
6
- var isNil_cjs = require('./is-nil.cjs');
7
- var isObjectLike_cjs = require('./is-object-like.cjs');
8
- var isPlainObject_cjs = require('./is-plain-object.cjs');
9
- var remember_cjs = require('./remember.cjs');
10
- var storageAvailable_cjs = require('./storage-available.cjs');
11
-
12
-
13
-
14
- Object.keys(capitalize_cjs).forEach(function (k) {
15
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
16
- enumerable: true,
17
- get: function () { return capitalize_cjs[k]; }
18
- });
19
- });
20
- Object.keys(debounce_cjs).forEach(function (k) {
21
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
22
- enumerable: true,
23
- get: function () { return debounce_cjs[k]; }
24
- });
25
- });
26
- Object.keys(invariant_cjs).forEach(function (k) {
27
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
28
- enumerable: true,
29
- get: function () { return invariant_cjs[k]; }
30
- });
31
- });
32
- Object.keys(isNil_cjs).forEach(function (k) {
33
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
34
- enumerable: true,
35
- get: function () { return isNil_cjs[k]; }
36
- });
37
- });
38
- Object.keys(isObjectLike_cjs).forEach(function (k) {
39
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
40
- enumerable: true,
41
- get: function () { return isObjectLike_cjs[k]; }
42
- });
43
- });
44
- Object.keys(isPlainObject_cjs).forEach(function (k) {
45
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
46
- enumerable: true,
47
- get: function () { return isPlainObject_cjs[k]; }
48
- });
49
- });
50
- Object.keys(remember_cjs).forEach(function (k) {
51
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
52
- enumerable: true,
53
- get: function () { return remember_cjs[k]; }
54
- });
55
- });
56
- Object.keys(storageAvailable_cjs).forEach(function (k) {
57
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
58
- enumerable: true,
59
- get: function () { return storageAvailable_cjs[k]; }
60
- });
61
- });
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;
62
2
  //# sourceMappingURL=index.cjs.map
63
- //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs","sourcesContent":[]}
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,10 +1,2 @@
1
- export * from './capitalize.js';
2
- export * from './debounce.js';
3
- export * from './invariant.js';
4
- export * from './is-nil.js';
5
- export * from './is-object-like.js';
6
- export * from './is-plain-object.js';
7
- export * from './remember.js';
8
- export * 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
10
- //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,32 +1,2 @@
1
- 'use strict';
2
-
3
- // src/invariant.ts
4
- var InvariantError = class extends Error {
5
- constructor(message) {
6
- super(message);
7
- this.name = "InvariantError";
8
- }
9
- };
10
- function isInvariantError(error) {
11
- return error instanceof InvariantError;
12
- }
13
- function invariant(condition, message) {
14
- if (!condition) {
15
- throw new InvariantError(typeof message === "function" ? message() : message);
16
- }
17
- }
18
- function invariantResponse(condition, message, responseInit) {
19
- if (!condition) {
20
- throw new Response(typeof message === "function" ? message() : message, {
21
- status: 400,
22
- ...responseInit
23
- });
24
- }
25
- }
26
-
27
- exports.InvariantError = InvariantError;
28
- exports.invariant = invariant;
29
- exports.invariantResponse = invariantResponse;
30
- 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;
31
2
  //# sourceMappingURL=invariant.cjs.map
32
- //# sourceMappingURL=invariant.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/invariant.ts"],"names":[],"mappings":";;;AAAO,IAAM,cAAA,GAAN,cAA6B,KAAA,CAAM;AAAA,EACxC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AAEb,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AAAA,EACd;AACF;AAEO,SAAS,iBAAiB,KAAA,EAAyC;AACxE,EAAA,OAAO,KAAA,YAAiB,cAAA;AAC1B;AAKO,SAAS,SAAA,CAAU,WAAoB,OAAA,EAAqD;AACjG,EAAA,IAAI,CAAC,SAAA,EAAW;AACd,IAAA,MAAM,IAAI,cAAA,CAAe,OAAO,YAAY,UAAA,GAAa,OAAA,KAAY,OAAO,CAAA;AAAA,EAC9E;AACF;AAKO,SAAS,iBAAA,CACd,SAAA,EACA,OAAA,EACA,YAAA,EACmB;AACnB,EAAA,IAAI,CAAC,SAAA,EAAW;AAEd,IAAA,MAAM,IAAI,QAAA,CAAS,OAAO,YAAY,UAAA,GAAa,OAAA,KAAY,OAAA,EAAS;AAAA,MACtE,MAAA,EAAQ,GAAA;AAAA,MACR,GAAG;AAAA,KACJ,CAAA;AAAA,EACH;AACF","file":"invariant.cjs","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"]}
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,27 +1,2 @@
1
- // src/invariant.ts
2
- var InvariantError = class extends Error {
3
- constructor(message) {
4
- super(message);
5
- this.name = "InvariantError";
6
- }
7
- };
8
- function isInvariantError(error) {
9
- return error instanceof InvariantError;
10
- }
11
- function invariant(condition, message) {
12
- if (!condition) {
13
- throw new InvariantError(typeof message === "function" ? message() : message);
14
- }
15
- }
16
- function invariantResponse(condition, message, responseInit) {
17
- if (!condition) {
18
- throw new Response(typeof message === "function" ? message() : message, {
19
- status: 400,
20
- ...responseInit
21
- });
22
- }
23
- }
24
-
25
- 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};
26
2
  //# sourceMappingURL=invariant.js.map
27
- //# sourceMappingURL=invariant.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/invariant.ts"],"names":[],"mappings":";AAAO,IAAM,cAAA,GAAN,cAA6B,KAAA,CAAM;AAAA,EACxC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AAEb,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AAAA,EACd;AACF;AAEO,SAAS,iBAAiB,KAAA,EAAyC;AACxE,EAAA,OAAO,KAAA,YAAiB,cAAA;AAC1B;AAKO,SAAS,SAAA,CAAU,WAAoB,OAAA,EAAqD;AACjG,EAAA,IAAI,CAAC,SAAA,EAAW;AACd,IAAA,MAAM,IAAI,cAAA,CAAe,OAAO,YAAY,UAAA,GAAa,OAAA,KAAY,OAAO,CAAA;AAAA,EAC9E;AACF;AAKO,SAAS,iBAAA,CACd,SAAA,EACA,OAAA,EACA,YAAA,EACmB;AACnB,EAAA,IAAI,CAAC,SAAA,EAAW;AAEd,IAAA,MAAM,IAAI,QAAA,CAAS,OAAO,YAAY,UAAA,GAAa,OAAA,KAAY,OAAA,EAAS;AAAA,MACtE,MAAA,EAAQ,GAAA;AAAA,MACR,GAAG;AAAA,KACJ,CAAA;AAAA,EACH;AACF","file":"invariant.js","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"]}
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,10 +1,2 @@
1
- 'use strict';
2
-
3
- // src/is-nil.ts
4
- function isNil(value) {
5
- return value == null;
6
- }
7
-
8
- exports.isNil = isNil;
1
+ "use strict";function isNil(value){return value==null}exports.isNil=isNil;
9
2
  //# sourceMappingURL=is-nil.cjs.map
10
- //# sourceMappingURL=is-nil.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/is-nil.ts"],"names":[],"mappings":";;;AAAO,SAAS,MAAM,KAAA,EAA2C;AAC/D,EAAA,OAAO,KAAA,IAAS,IAAA;AAClB","file":"is-nil.cjs","sourcesContent":["export function isNil(value: unknown): value is null | undefined {\n return value == null;\n}\n"]}
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,8 +1,2 @@
1
- // src/is-nil.ts
2
- function isNil(value) {
3
- return value == null;
4
- }
5
-
6
- export { isNil };
1
+ function isNil(value){return value==null}export{isNil};
7
2
  //# sourceMappingURL=is-nil.js.map
8
- //# sourceMappingURL=is-nil.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/is-nil.ts"],"names":[],"mappings":";AAAO,SAAS,MAAM,KAAA,EAA2C;AAC/D,EAAA,OAAO,KAAA,IAAS,IAAA;AAClB","file":"is-nil.js","sourcesContent":["export function isNil(value: unknown): value is null | undefined {\n return value == null;\n}\n"]}
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,10 +1,2 @@
1
- 'use strict';
2
-
3
- // src/is-object-like.ts
4
- function isObjectLike(value) {
5
- return typeof value === "object" && value !== null;
6
- }
7
-
8
- exports.isObjectLike = isObjectLike;
1
+ "use strict";function isObjectLike(value){return typeof value==="object"&&value!==null}exports.isObjectLike=isObjectLike;
9
2
  //# sourceMappingURL=is-object-like.cjs.map
10
- //# sourceMappingURL=is-object-like.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/is-object-like.ts"],"names":[],"mappings":";;;AAAO,SAAS,aAAa,KAAA,EAAiC;AAC5D,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA;AAChD","file":"is-object-like.cjs","sourcesContent":["export function isObjectLike(value: unknown): value is object {\n return typeof value === 'object' && value !== null;\n}\n"]}
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,8 +1,2 @@
1
- // src/is-object-like.ts
2
- function isObjectLike(value) {
3
- return typeof value === "object" && value !== null;
4
- }
5
-
6
- export { isObjectLike };
1
+ function isObjectLike(value){return typeof value==="object"&&value!==null}export{isObjectLike};
7
2
  //# sourceMappingURL=is-object-like.js.map
8
- //# sourceMappingURL=is-object-like.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/is-object-like.ts"],"names":[],"mappings":";AAAO,SAAS,aAAa,KAAA,EAAiC;AAC5D,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA;AAChD","file":"is-object-like.js","sourcesContent":["export function isObjectLike(value: unknown): value is object {\n return typeof value === 'object' && value !== null;\n}\n"]}
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,16 +1,2 @@
1
- 'use strict';
2
-
3
- var isObjectLike_cjs = require('./is-object-like.cjs');
4
-
5
- // src/is-plain-object.ts
6
- function isPlainObject(value) {
7
- if (!isObjectLike_cjs.isObjectLike(value)) {
8
- return false;
9
- }
10
- const prototype = Object.getPrototypeOf(value);
11
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
12
- }
13
-
14
- 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;
15
2
  //# sourceMappingURL=is-plain-object.cjs.map
16
- //# sourceMappingURL=is-plain-object.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/is-plain-object.ts"],"names":["isObjectLike"],"mappings":";;;;;AAEO,SAAS,cAAc,KAAA,EAAiC;AAC7D,EAAA,IAAI,CAACA,6BAAA,CAAa,KAAK,CAAA,EAAG;AACxB,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,cAAA,CAAe,KAAK,CAAA;AAE7C,EAAA,OAAA,CACG,cAAc,IAAA,IAAQ,SAAA,KAAc,MAAA,CAAO,SAAA,IAAa,OAAO,cAAA,CAAe,SAAS,CAAA,KAAM,IAAA,KAC9F,EAAE,MAAA,CAAO,WAAA,IAAe,KAAA,CAAA,IACxB,EAAE,OAAO,QAAA,IAAY,KAAA,CAAA;AAEzB","file":"is-plain-object.cjs","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"]}
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,14 +1,2 @@
1
- import { isObjectLike } from './is-object-like.js';
2
-
3
- // src/is-plain-object.ts
4
- function isPlainObject(value) {
5
- if (!isObjectLike(value)) {
6
- return false;
7
- }
8
- const prototype = Object.getPrototypeOf(value);
9
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
10
- }
11
-
12
- 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};
13
2
  //# sourceMappingURL=is-plain-object.js.map
14
- //# sourceMappingURL=is-plain-object.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/is-plain-object.ts"],"names":[],"mappings":";;;AAEO,SAAS,cAAc,KAAA,EAAiC;AAC7D,EAAA,IAAI,CAAC,YAAA,CAAa,KAAK,CAAA,EAAG;AACxB,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,cAAA,CAAe,KAAK,CAAA;AAE7C,EAAA,OAAA,CACG,cAAc,IAAA,IAAQ,SAAA,KAAc,MAAA,CAAO,SAAA,IAAa,OAAO,cAAA,CAAe,SAAS,CAAA,KAAM,IAAA,KAC9F,EAAE,MAAA,CAAO,WAAA,IAAe,KAAA,CAAA,IACxB,EAAE,OAAO,QAAA,IAAY,KAAA,CAAA;AAEzB","file":"is-plain-object.js","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"]}
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,17 +1,2 @@
1
- 'use strict';
2
-
3
- // src/remember.ts
4
- function remember(name, getValue) {
5
- const ctx = globalThis;
6
- if (!ctx.__remember) {
7
- ctx.__remember = /* @__PURE__ */ new Map();
8
- }
9
- if (!ctx.__remember.has(name)) {
10
- ctx.__remember.set(name, getValue());
11
- }
12
- return ctx.__remember.get(name);
13
- }
14
-
15
- 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;
16
2
  //# sourceMappingURL=remember.cjs.map
17
- //# sourceMappingURL=remember.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/remember.ts"],"names":[],"mappings":";;;AAKO,SAAS,QAAA,CAAY,MAAc,QAAA,EAAsB;AAC9D,EAAA,MAAM,GAAA,GAAM,UAAA;AAEZ,EAAA,IAAI,CAAC,IAAI,UAAA,EAAY;AACnB,IAAA,GAAA,CAAI,UAAA,uBAAiB,GAAA,EAAI;AAAA,EAC3B;AAEA,EAAA,IAAI,CAAC,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,IAAI,CAAA,EAAG;AAC7B,IAAA,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,IAAA,EAAM,QAAA,EAAU,CAAA;AAAA,EACrC;AAEA,EAAA,OAAO,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,IAAI,CAAA;AAChC","file":"remember.cjs","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"]}
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,15 +1,2 @@
1
- // src/remember.ts
2
- function remember(name, getValue) {
3
- const ctx = globalThis;
4
- if (!ctx.__remember) {
5
- ctx.__remember = /* @__PURE__ */ new Map();
6
- }
7
- if (!ctx.__remember.has(name)) {
8
- ctx.__remember.set(name, getValue());
9
- }
10
- return ctx.__remember.get(name);
11
- }
12
-
13
- 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};
14
2
  //# sourceMappingURL=remember.js.map
15
- //# sourceMappingURL=remember.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/remember.ts"],"names":[],"mappings":";AAKO,SAAS,QAAA,CAAY,MAAc,QAAA,EAAsB;AAC9D,EAAA,MAAM,GAAA,GAAM,UAAA;AAEZ,EAAA,IAAI,CAAC,IAAI,UAAA,EAAY;AACnB,IAAA,GAAA,CAAI,UAAA,uBAAiB,GAAA,EAAI;AAAA,EAC3B;AAEA,EAAA,IAAI,CAAC,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,IAAI,CAAA,EAAG;AAC7B,IAAA,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,IAAA,EAAM,QAAA,EAAU,CAAA;AAAA,EACrC;AAEA,EAAA,OAAO,GAAA,CAAI,UAAA,CAAW,GAAA,CAAI,IAAI,CAAA;AAChC","file":"remember.js","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"]}
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,19 +1,2 @@
1
- 'use strict';
2
-
3
- // src/storage-available.ts
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
- 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;
18
2
  //# sourceMappingURL=storage-available.cjs.map
19
- //# sourceMappingURL=storage-available.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/storage-available.ts"],"names":[],"mappings":";;;AAGO,SAAS,iBAAiB,IAAA,EAAkD;AACjF,EAAA,IAAI,OAAA;AAEJ,EAAA,IAAI;AACF,IAAA,OAAA,GAAU,OAAO,IAAI,CAAA;AAErB,IAAA,MAAM,CAAA,GAAI,KAAK,IAAI,CAAA,EAAA,CAAA;AACnB,IAAA,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAC,CAAA;AACpB,IAAA,OAAA,CAAQ,WAAW,CAAC,CAAA;AAEpB,IAAA,OAAO,IAAA;AAAA,EACT,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,CAAA,YAAa,gBAAgB,CAAA,CAAE,IAAA,KAAS,wBAAwB,CAAC,CAAC,OAAA,IAAW,OAAA,CAAQ,MAAA,KAAW,CAAA;AAAA,EACzG;AACF","file":"storage-available.cjs","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"]}
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,17 +1,2 @@
1
- // src/storage-available.ts
2
- function storageAvailable(type) {
3
- let storage;
4
- try {
5
- storage = window[type];
6
- const x = `__${type}__`;
7
- storage.setItem(x, x);
8
- storage.removeItem(x);
9
- return true;
10
- } catch (e) {
11
- return e instanceof DOMException && e.name === "QuotaExceededError" && !!storage && storage.length !== 0;
12
- }
13
- }
14
-
15
- 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};
16
2
  //# sourceMappingURL=storage-available.js.map
17
- //# sourceMappingURL=storage-available.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/storage-available.ts"],"names":[],"mappings":";AAGO,SAAS,iBAAiB,IAAA,EAAkD;AACjF,EAAA,IAAI,OAAA;AAEJ,EAAA,IAAI;AACF,IAAA,OAAA,GAAU,OAAO,IAAI,CAAA;AAErB,IAAA,MAAM,CAAA,GAAI,KAAK,IAAI,CAAA,EAAA,CAAA;AACnB,IAAA,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAC,CAAA;AACpB,IAAA,OAAA,CAAQ,WAAW,CAAC,CAAA;AAEpB,IAAA,OAAO,IAAA;AAAA,EACT,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,CAAA,YAAa,gBAAgB,CAAA,CAAE,IAAA,KAAS,wBAAwB,CAAC,CAAC,OAAA,IAAW,OAAA,CAAQ,MAAA,KAAW,CAAA;AAAA,EACzG;AACF","file":"storage-available.js","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"]}
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,9 +1,24 @@
1
1
  {
2
2
  "name": "@mado/utils",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
+ "homepage": "https://github.com/doinki/mado/tree/main/packages/mado-utils#readme",
5
+ "bugs": "https://github.com/doinki/mado/issues",
4
6
  "license": "MIT",
5
- "sideEffects": false,
7
+ "author": {
8
+ "name": "doinki",
9
+ "email": "doinki94@gmail.com",
10
+ "url": "https://github.com/doinki"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/doinki/mado.git",
15
+ "directory": "packages/mado-utils"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
6
20
  "type": "module",
21
+ "sideEffects": false,
7
22
  "main": "./dist/index.cjs",
8
23
  "module": "./dist/index.js",
9
24
  "types": "./dist/index.d.ts",
@@ -20,29 +35,20 @@
20
35
  },
21
36
  "./package.json": "./package.json"
22
37
  },
23
- "author": {
24
- "email": "doinki94@gmail.com",
25
- "name": "doinki",
26
- "url": "https://github.com/doinki"
27
- },
28
- "bugs": "https://github.com/doinki/mado/issues",
29
- "files": [
30
- "dist"
31
- ],
32
- "homepage": "https://github.com/doinki/mado/tree/main/packages/mado-utils#readme",
33
- "repository": {
34
- "directory": "packages/mado-utils",
35
- "type": "git",
36
- "url": "git+https://github.com/doinki/mado.git"
37
- },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
+ "dependencies": {
42
+ "@babel/runtime": "^7.29.15"
43
+ },
44
+ "devDependencies": {
45
+ "@vitest/coverage-istanbul": "^5.1.1",
46
+ "happy-dom": "^21.0.4"
47
+ },
41
48
  "scripts": {
42
- "build": "tsup",
49
+ "build": "rimraf dist && rollup -c --environment NODE_ENV:production",
43
50
  "test": "vitest run",
44
51
  "test:coverage": "vitest run --coverage",
45
- "lint": "eslint",
46
52
  "publint": "publint",
47
53
  "typecheck": "tsc --noEmit"
48
54
  }