@mado/utils 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
- // src/capitalize.ts
4
3
  function capitalize(str) {
5
4
  return str.charAt(0).toUpperCase() + str.substring(1);
6
5
  }
7
6
 
8
7
  exports.capitalize = capitalize;
9
8
  //# 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,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,8 +1,6 @@
1
- // src/capitalize.ts
2
1
  function capitalize(str) {
3
2
  return str.charAt(0).toUpperCase() + str.substring(1);
4
3
  }
5
4
 
6
5
  export { capitalize };
7
6
  //# 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,UAAUA,CAACC,GAAW,EAAU;AAC9C,EAAA,OAAOA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,GAAGF,GAAG,CAACG,SAAS,CAAC,CAAC,CAAC;AACvD;;"}
package/dist/debounce.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- // src/debounce.ts
4
3
  function debounce(func, wait = 166) {
5
4
  let timeout;
6
5
  function debounced(...args) {
7
6
  clearTimeout(timeout);
8
7
  timeout = setTimeout(() => {
8
+ // @ts-ignore
9
9
  func.apply(this, args);
10
10
  }, wait);
11
11
  }
@@ -17,4 +17,3 @@ function debounce(func, wait = 166) {
17
17
 
18
18
  exports.debounce = debounce;
19
19
  //# 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 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;;"}
@@ -3,4 +3,5 @@ interface Cancelable {
3
3
  }
4
4
  declare function debounce<T extends (...args: any[]) => any>(func: T, wait?: number): T & Cancelable;
5
5
 
6
- export { type Cancelable, debounce };
6
+ export { debounce };
7
+ export type { Cancelable };
@@ -3,4 +3,5 @@ interface Cancelable {
3
3
  }
4
4
  declare function debounce<T extends (...args: any[]) => any>(func: T, wait?: number): T & Cancelable;
5
5
 
6
- export { type Cancelable, debounce };
6
+ export { debounce };
7
+ export type { Cancelable };
package/dist/debounce.js CHANGED
@@ -1,9 +1,9 @@
1
- // src/debounce.ts
2
1
  function debounce(func, wait = 166) {
3
2
  let timeout;
4
3
  function debounced(...args) {
5
4
  clearTimeout(timeout);
6
5
  timeout = setTimeout(() => {
6
+ // @ts-ignore
7
7
  func.apply(this, args);
8
8
  }, wait);
9
9
  }
@@ -15,4 +15,3 @@ function debounce(func, wait = 166) {
15
15
 
16
16
  export { debounce };
17
17
  //# 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 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;;"}
package/dist/index.cjs CHANGED
@@ -1,63 +1,25 @@
1
1
  'use strict';
2
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');
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
11
 
12
12
 
13
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
- });
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;
62
25
  //# 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.js CHANGED
@@ -1,10 +1,9 @@
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';
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';
9
9
  //# 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,23 +1,31 @@
1
1
  'use strict';
2
2
 
3
- // src/invariant.ts
4
- var InvariantError = class extends Error {
3
+ class InvariantError extends Error {
5
4
  constructor(message) {
6
5
  super(message);
7
- this.name = "InvariantError";
6
+ this.name = 'InvariantError';
8
7
  }
9
- };
8
+ }
10
9
  function isInvariantError(error) {
11
10
  return error instanceof InvariantError;
12
11
  }
12
+
13
+ /**
14
+ * @throws {InvariantError}
15
+ */
13
16
  function invariant(condition, message) {
14
17
  if (!condition) {
15
- throw new InvariantError(typeof message === "function" ? message() : message);
18
+ throw new InvariantError(typeof message === 'function' ? message() : message);
16
19
  }
17
20
  }
21
+
22
+ /**
23
+ * @throws {Response}
24
+ */
18
25
  function invariantResponse(condition, message, responseInit) {
19
26
  if (!condition) {
20
- throw new Response(typeof message === "function" ? message() : message, {
27
+ // eslint-disable-next-line @typescript-eslint/only-throw-error
28
+ throw new Response(typeof message === 'function' ? message() : message, {
21
29
  status: 400,
22
30
  ...responseInit
23
31
  });
@@ -29,4 +37,3 @@ exports.invariant = invariant;
29
37
  exports.invariantResponse = invariantResponse;
30
38
  exports.isInvariantError = isInvariantError;
31
39
  //# 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 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;;;;;"}
package/dist/invariant.js CHANGED
@@ -1,21 +1,29 @@
1
- // src/invariant.ts
2
- var InvariantError = class extends Error {
1
+ class InvariantError extends Error {
3
2
  constructor(message) {
4
3
  super(message);
5
- this.name = "InvariantError";
4
+ this.name = 'InvariantError';
6
5
  }
7
- };
6
+ }
8
7
  function isInvariantError(error) {
9
8
  return error instanceof InvariantError;
10
9
  }
10
+
11
+ /**
12
+ * @throws {InvariantError}
13
+ */
11
14
  function invariant(condition, message) {
12
15
  if (!condition) {
13
- throw new InvariantError(typeof message === "function" ? message() : message);
16
+ throw new InvariantError(typeof message === 'function' ? message() : message);
14
17
  }
15
18
  }
19
+
20
+ /**
21
+ * @throws {Response}
22
+ */
16
23
  function invariantResponse(condition, message, responseInit) {
17
24
  if (!condition) {
18
- throw new Response(typeof message === "function" ? message() : message, {
25
+ // eslint-disable-next-line @typescript-eslint/only-throw-error
26
+ throw new Response(typeof message === 'function' ? message() : message, {
19
27
  status: 400,
20
28
  ...responseInit
21
29
  });
@@ -24,4 +32,3 @@ function invariantResponse(condition, message, responseInit) {
24
32
 
25
33
  export { InvariantError, invariant, invariantResponse, isInvariantError };
26
34
  //# 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 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;;"}
package/dist/is-nil.cjs CHANGED
@@ -1,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
- // src/is-nil.ts
4
3
  function isNil(value) {
5
4
  return value == null;
6
5
  }
7
6
 
8
7
  exports.isNil = isNil;
9
8
  //# 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,KAAKA,CAACC,KAAc,EAA6B;EAC/D,OAAOA,KAAK,IAAI,IAAI;AACtB;;"}
package/dist/is-nil.js CHANGED
@@ -1,8 +1,6 @@
1
- // src/is-nil.ts
2
1
  function isNil(value) {
3
2
  return value == null;
4
3
  }
5
4
 
6
5
  export { isNil };
7
6
  //# 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,KAAKA,CAACC,KAAc,EAA6B;EAC/D,OAAOA,KAAK,IAAI,IAAI;AACtB;;"}
@@ -1,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
- // src/is-object-like.ts
4
3
  function isObjectLike(value) {
5
- return typeof value === "object" && value !== null;
4
+ return typeof value === 'object' && value !== null;
6
5
  }
7
6
 
8
7
  exports.isObjectLike = isObjectLike;
9
8
  //# 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,YAAYA,CAACC,KAAc,EAAmB;AAC5D,EAAA,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI;AACpD;;"}
@@ -1,8 +1,6 @@
1
- // src/is-object-like.ts
2
1
  function isObjectLike(value) {
3
- return typeof value === "object" && value !== null;
2
+ return typeof value === 'object' && value !== null;
4
3
  }
5
4
 
6
5
  export { isObjectLike };
7
6
  //# 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,YAAYA,CAACC,KAAc,EAAmB;AAC5D,EAAA,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI;AACpD;;"}
@@ -1,10 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var isObjectLike_cjs = require('./is-object-like.cjs');
3
+ var isObjectLike = require('./is-object-like.cjs');
4
4
 
5
- // src/is-plain-object.ts
6
5
  function isPlainObject(value) {
7
- if (!isObjectLike_cjs.isObjectLike(value)) {
6
+ if (!isObjectLike.isObjectLike(value)) {
8
7
  return false;
9
8
  }
10
9
  const prototype = Object.getPrototypeOf(value);
@@ -13,4 +12,3 @@ function isPlainObject(value) {
13
12
 
14
13
  exports.isPlainObject = isPlainObject;
15
14
  //# 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 = 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,6 +1,5 @@
1
1
  import { isObjectLike } from './is-object-like.js';
2
2
 
3
- // src/is-plain-object.ts
4
3
  function isPlainObject(value) {
5
4
  if (!isObjectLike(value)) {
6
5
  return false;
@@ -11,4 +10,3 @@ function isPlainObject(value) {
11
10
 
12
11
  export { isPlainObject };
13
12
  //# 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 = 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;;"}
package/dist/remember.cjs CHANGED
@@ -1,10 +1,9 @@
1
1
  'use strict';
2
2
 
3
- // src/remember.ts
4
3
  function remember(name, getValue) {
5
4
  const ctx = globalThis;
6
5
  if (!ctx.__remember) {
7
- ctx.__remember = /* @__PURE__ */ new Map();
6
+ ctx.__remember = new Map();
8
7
  }
9
8
  if (!ctx.__remember.has(name)) {
10
9
  ctx.__remember.set(name, getValue());
@@ -14,4 +13,3 @@ function remember(name, getValue) {
14
13
 
15
14
  exports.remember = remember;
16
15
  //# 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":["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;;"}
package/dist/remember.js CHANGED
@@ -1,8 +1,7 @@
1
- // src/remember.ts
2
1
  function remember(name, getValue) {
3
2
  const ctx = globalThis;
4
3
  if (!ctx.__remember) {
5
- ctx.__remember = /* @__PURE__ */ new Map();
4
+ ctx.__remember = new Map();
6
5
  }
7
6
  if (!ctx.__remember.has(name)) {
8
7
  ctx.__remember.set(name, getValue());
@@ -12,4 +11,3 @@ function remember(name, getValue) {
12
11
 
13
12
  export { remember };
14
13
  //# 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":["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,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
- // src/storage-available.ts
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
+ */
4
6
  function storageAvailable(type) {
5
7
  let storage;
6
8
  try {
@@ -10,10 +12,9 @@ function storageAvailable(type) {
10
12
  storage.removeItem(x);
11
13
  return true;
12
14
  } catch (e) {
13
- return e instanceof DOMException && e.name === "QuotaExceededError" && !!storage && storage.length !== 0;
15
+ return e instanceof DOMException && e.name === 'QuotaExceededError' && !!storage && storage.length !== 0;
14
16
  }
15
17
  }
16
18
 
17
19
  exports.storageAvailable = storageAvailable;
18
20
  //# 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":";;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,4 +1,6 @@
1
- // src/storage-available.ts
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
+ */
2
4
  function storageAvailable(type) {
3
5
  let storage;
4
6
  try {
@@ -8,10 +10,9 @@ function storageAvailable(type) {
8
10
  storage.removeItem(x);
9
11
  return true;
10
12
  } catch (e) {
11
- return e instanceof DOMException && e.name === "QuotaExceededError" && !!storage && storage.length !== 0;
13
+ return e instanceof DOMException && e.name === 'QuotaExceededError' && !!storage && storage.length !== 0;
12
14
  }
13
15
  }
14
16
 
15
17
  export { storageAvailable };
16
18
  //# 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":"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;;"}
package/package.json CHANGED
@@ -1,9 +1,24 @@
1
1
  {
2
2
  "name": "@mado/utils",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
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.10"
43
+ },
44
+ "devDependencies": {
45
+ "@vitest/coverage-istanbul": "^5.0.5",
46
+ "happy-dom": "^21.0.3"
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
  }