@leyyo/common 1.3.8 → 1.3.9

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 (211) hide show
  1. package/dist/base/index.d.ts +3 -3
  2. package/dist/base/index.js +3 -20
  3. package/dist/base/index.types.d.ts +32 -18
  4. package/dist/base/index.types.js +1 -3
  5. package/dist/base/leyyo.d.ts +1 -1
  6. package/dist/base/leyyo.js +35 -26
  7. package/dist/base/leyyo.types.d.ts +3 -3
  8. package/dist/base/leyyo.types.js +1 -3
  9. package/dist/class/index.d.ts +2 -2
  10. package/dist/class/index.js +2 -19
  11. package/dist/class/index.types.d.ts +1 -1
  12. package/dist/class/index.types.js +1 -3
  13. package/dist/class/list.d.ts +1 -1
  14. package/dist/class/list.js +1 -6
  15. package/dist/class/logger.instance.d.ts +5 -5
  16. package/dist/class/logger.instance.js +8 -12
  17. package/dist/common/deploy.common.d.ts +2 -2
  18. package/dist/common/deploy.common.js +14 -16
  19. package/dist/common/enum.pool.d.ts +5 -3
  20. package/dist/common/enum.pool.js +36 -48
  21. package/dist/common/error.common.d.ts +4 -4
  22. package/dist/common/error.common.js +45 -85
  23. package/dist/common/error.pool.d.ts +5 -3
  24. package/dist/common/error.pool.js +12 -23
  25. package/dist/common/event.common.d.ts +2 -2
  26. package/dist/common/event.common.js +25 -28
  27. package/dist/common/index.d.ts +11 -11
  28. package/dist/common/index.js +11 -28
  29. package/dist/common/index.types.d.ts +42 -6
  30. package/dist/common/index.types.js +1 -3
  31. package/dist/common/inert.d.ts +4 -2
  32. package/dist/common/inert.js +97 -110
  33. package/dist/common/lifecycle.common.d.ts +2 -2
  34. package/dist/common/lifecycle.common.js +48 -61
  35. package/dist/common/literal.pool.d.ts +6 -3
  36. package/dist/common/literal.pool.js +37 -48
  37. package/dist/common/log.common.d.ts +4 -4
  38. package/dist/common/log.common.js +63 -60
  39. package/dist/common/repo.common.d.ts +3 -3
  40. package/dist/common/repo.common.js +50 -52
  41. package/dist/const/index.js +26 -30
  42. package/dist/enum/index.d.ts +1 -1
  43. package/dist/enum/index.js +1 -18
  44. package/dist/enum/log-level.js +1 -5
  45. package/dist/error/caused.error.d.ts +2 -2
  46. package/dist/error/caused.error.js +2 -7
  47. package/dist/error/developer.error.d.ts +3 -3
  48. package/dist/error/developer.error.js +9 -9
  49. package/dist/error/http.error.d.ts +2 -2
  50. package/dist/error/http.error.js +9 -15
  51. package/dist/error/index.d.ts +7 -7
  52. package/dist/error/index.js +7 -24
  53. package/dist/error/index.types.d.ts +3 -3
  54. package/dist/error/index.types.js +1 -3
  55. package/dist/error/invalid-value.error.d.ts +1 -1
  56. package/dist/error/invalid-value.error.js +6 -13
  57. package/dist/error/leyyo.error.d.ts +5 -5
  58. package/dist/error/leyyo.error.js +45 -34
  59. package/dist/error/multiple.error.d.ts +2 -2
  60. package/dist/error/multiple.error.js +6 -12
  61. package/dist/function/define-loader.d.ts +1 -1
  62. package/dist/function/define-loader.js +7 -10
  63. package/dist/function/delay.js +2 -6
  64. package/dist/function/delete-prop.js +9 -15
  65. package/dist/function/{empty.fn.js → empty-fn.js} +1 -5
  66. package/dist/function/extended-type.d.ts +1 -1
  67. package/dist/function/extended-type.js +8 -12
  68. package/dist/function/get-fqn.d.ts +1 -1
  69. package/dist/function/get-fqn.js +7 -12
  70. package/dist/function/get-prop.js +10 -16
  71. package/dist/function/has-fqn.d.ts +1 -1
  72. package/dist/function/has-fqn.js +7 -11
  73. package/dist/function/index.d.ts +38 -28
  74. package/dist/function/index.js +38 -45
  75. package/dist/function/index.types.d.ts +2 -2
  76. package/dist/function/index.types.js +1 -3
  77. package/dist/function/is-anonymous-name.js +3 -7
  78. package/dist/function/is-class.d.ts +7 -0
  79. package/dist/function/is-class.js +18 -0
  80. package/dist/function/is-empty.d.ts +12 -0
  81. package/dist/function/is-empty.js +18 -0
  82. package/dist/function/is-filled-arr.d.ts +10 -0
  83. package/dist/function/is-filled-arr.js +12 -0
  84. package/dist/function/is-filled-obj.d.ts +10 -0
  85. package/dist/function/is-filled-obj.js +13 -0
  86. package/dist/function/is-obj.d.ts +9 -0
  87. package/dist/function/is-obj.js +11 -0
  88. package/dist/function/is-test.js +2 -7
  89. package/dist/function/is-text.d.ts +11 -0
  90. package/dist/function/is-text.js +17 -0
  91. package/dist/function/jitter-interval.js +2 -6
  92. package/dist/function/leyyo-fn.d.ts +1 -1
  93. package/dist/function/leyyo-fn.js +2 -7
  94. package/dist/function/on-fqn-set.d.ts +1 -1
  95. package/dist/function/on-fqn-set.js +9 -13
  96. package/dist/function/one-or-more.d.ts +1 -1
  97. package/dist/function/one-or-more.js +1 -5
  98. package/dist/function/opt-add.d.ts +10 -0
  99. package/dist/function/opt-add.js +29 -0
  100. package/dist/function/opt-append.d.ts +9 -0
  101. package/dist/function/opt-append.js +24 -0
  102. package/dist/function/opt-check.d.ts +8 -0
  103. package/dist/function/opt-check.js +31 -0
  104. package/dist/function/opt-clone.d.ts +8 -0
  105. package/dist/function/opt-clone.js +12 -0
  106. package/dist/function/opt-field.d.ts +11 -0
  107. package/dist/function/opt-field.js +31 -0
  108. package/dist/function/opt-fn.d.ts +8 -0
  109. package/dist/function/opt-fn.js +11 -0
  110. package/dist/function/random-test-no.js +1 -5
  111. package/dist/function/remove-fqn.d.ts +1 -1
  112. package/dist/function/remove-fqn.js +10 -14
  113. package/dist/function/run-exporter.d.ts +1 -1
  114. package/dist/function/run-exporter.js +12 -27
  115. package/dist/function/secure-clone.d.ts +1 -1
  116. package/dist/function/secure-clone.js +2 -7
  117. package/dist/function/secure-json.js +6 -12
  118. package/dist/function/set-anonymous-fqn.d.ts +1 -1
  119. package/dist/function/set-anonymous-fqn.js +15 -19
  120. package/dist/function/set-anonymous-name.d.ts +1 -1
  121. package/dist/function/set-anonymous-name.js +23 -26
  122. package/dist/function/set-fqn.d.ts +1 -1
  123. package/dist/function/set-fqn.js +28 -31
  124. package/dist/function/set-prop.js +9 -15
  125. package/dist/function/stamp-loader.d.ts +1 -1
  126. package/dist/function/stamp-loader.js +4 -8
  127. package/dist/function/test-case.js +5 -9
  128. package/dist/function/test-name.js +4 -8
  129. package/dist/function/trigger-fqn.d.ts +1 -1
  130. package/dist/function/trigger-fqn.js +5 -9
  131. package/dist/index.d.ts +19 -19
  132. package/dist/index.foretell.js +10 -88
  133. package/dist/index.js +22 -40
  134. package/dist/index.loader.d.ts +1 -1
  135. package/dist/index.loader.js +6 -43
  136. package/dist/init/index.js +3 -7
  137. package/dist/internal.js +1 -5
  138. package/package.json +26 -16
  139. package/dist/assets/.gitkeep +0 -0
  140. package/dist/base/index.js.map +0 -1
  141. package/dist/base/index.types.js.map +0 -1
  142. package/dist/base/leyyo.js.map +0 -1
  143. package/dist/base/leyyo.types.js.map +0 -1
  144. package/dist/class/index.js.map +0 -1
  145. package/dist/class/index.types.js.map +0 -1
  146. package/dist/class/list.js.map +0 -1
  147. package/dist/class/logger.instance.js.map +0 -1
  148. package/dist/common/deploy.common.js.map +0 -1
  149. package/dist/common/enum.pool.js.map +0 -1
  150. package/dist/common/error.common.js.map +0 -1
  151. package/dist/common/error.pool.js.map +0 -1
  152. package/dist/common/event.common.js.map +0 -1
  153. package/dist/common/index.js.map +0 -1
  154. package/dist/common/index.types.js.map +0 -1
  155. package/dist/common/inert.js.map +0 -1
  156. package/dist/common/lifecycle.common.js.map +0 -1
  157. package/dist/common/literal.pool.js.map +0 -1
  158. package/dist/common/log.common.js.map +0 -1
  159. package/dist/common/repo.common.js.map +0 -1
  160. package/dist/const/index.js.map +0 -1
  161. package/dist/enum/index.js.map +0 -1
  162. package/dist/enum/log-level.js.map +0 -1
  163. package/dist/error/caused.error.js.map +0 -1
  164. package/dist/error/developer.error.js.map +0 -1
  165. package/dist/error/http.error.js.map +0 -1
  166. package/dist/error/index.js.map +0 -1
  167. package/dist/error/index.types.js.map +0 -1
  168. package/dist/error/invalid-value.error.js.map +0 -1
  169. package/dist/error/leyyo.error.js.map +0 -1
  170. package/dist/error/multiple.error.js.map +0 -1
  171. package/dist/function/define-loader.js.map +0 -1
  172. package/dist/function/delay.js.map +0 -1
  173. package/dist/function/delete-prop.js.map +0 -1
  174. package/dist/function/empty.fn.js.map +0 -1
  175. package/dist/function/extended-type.js.map +0 -1
  176. package/dist/function/get-fqn.js.map +0 -1
  177. package/dist/function/get-prop.js.map +0 -1
  178. package/dist/function/has-fqn.js.map +0 -1
  179. package/dist/function/index.js.map +0 -1
  180. package/dist/function/index.types.js.map +0 -1
  181. package/dist/function/is-anonymous-name.js.map +0 -1
  182. package/dist/function/is-test.js.map +0 -1
  183. package/dist/function/is.fn.d.ts +0 -59
  184. package/dist/function/is.fn.js +0 -93
  185. package/dist/function/is.fn.js.map +0 -1
  186. package/dist/function/jitter-interval.js.map +0 -1
  187. package/dist/function/leyyo-fn.js.map +0 -1
  188. package/dist/function/on-fqn-set.js.map +0 -1
  189. package/dist/function/one-or-more.js.map +0 -1
  190. package/dist/function/opt.fn.d.ts +0 -49
  191. package/dist/function/opt.fn.js +0 -142
  192. package/dist/function/opt.fn.js.map +0 -1
  193. package/dist/function/random-test-no.js.map +0 -1
  194. package/dist/function/remove-fqn.js.map +0 -1
  195. package/dist/function/run-exporter.js.map +0 -1
  196. package/dist/function/secure-clone.js.map +0 -1
  197. package/dist/function/secure-json.js.map +0 -1
  198. package/dist/function/set-anonymous-fqn.js.map +0 -1
  199. package/dist/function/set-anonymous-name.js.map +0 -1
  200. package/dist/function/set-fqn.js.map +0 -1
  201. package/dist/function/set-prop.js.map +0 -1
  202. package/dist/function/stamp-loader.js.map +0 -1
  203. package/dist/function/test-case.js.map +0 -1
  204. package/dist/function/test-name.js.map +0 -1
  205. package/dist/function/trigger-fqn.js.map +0 -1
  206. package/dist/index.foretell.js.map +0 -1
  207. package/dist/index.js.map +0 -1
  208. package/dist/index.loader.js.map +0 -1
  209. package/dist/init/index.js.map +0 -1
  210. package/dist/internal.js.map +0 -1
  211. /package/dist/function/{empty.fn.d.ts → empty-fn.d.ts} +0 -0
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extendedType = extendedType;
4
- const class_1 = require("../class");
5
- const const_1 = require("../const");
6
- const is_fn_1 = require("./is.fn");
1
+ import { List } from "../class/list.js";
2
+ import { KEY_ENUM_NAME, KEY_LITERAL_NAME } from "../const/index.js";
3
+ import { isClass } from "./is-class.js";
7
4
  // noinspection JSUnusedGlobalSymbols
8
5
  /**
9
6
  * Get extended type of value
@@ -11,7 +8,7 @@ const is_fn_1 = require("./is.fn");
11
8
  * @param {any} value - given value
12
9
  * @return {ExtendedType}
13
10
  * */
14
- function extendedType(value) {
11
+ export function extendedType(value) {
15
12
  switch (typeof value) {
16
13
  case "string":
17
14
  const trimmed = value.trim();
@@ -32,10 +29,10 @@ function extendedType(value) {
32
29
  return 'null';
33
30
  }
34
31
  if (Array.isArray(value)) {
35
- if (value[const_1.KEY_LITERAL_NAME]) {
32
+ if (value[KEY_LITERAL_NAME]) {
36
33
  return 'literal-items';
37
34
  }
38
- return (value instanceof class_1.List) ? 'list' : 'array';
35
+ return (value instanceof List) ? 'list' : 'array';
39
36
  }
40
37
  if (value instanceof Date) {
41
38
  return 'date';
@@ -46,14 +43,13 @@ function extendedType(value) {
46
43
  if (value instanceof Set) {
47
44
  return 'set';
48
45
  }
49
- if (value[const_1.KEY_ENUM_NAME]) {
46
+ if (value[KEY_ENUM_NAME]) {
50
47
  return 'enum-map';
51
48
  }
52
49
  return 'object';
53
50
  case "function":
54
- return (0, is_fn_1.isClass)(value) ? 'class' : 'function';
51
+ return isClass(value) ? 'class' : 'function';
55
52
  default:
56
53
  return typeof value;
57
54
  }
58
55
  }
59
- //# sourceMappingURL=extended-type.js.map
@@ -1,4 +1,4 @@
1
- import { FqnTarget } from "./index.types";
1
+ import { FqnTarget } from "./index.types.js";
2
2
  /**
3
3
  * Get fqn name
4
4
  *
@@ -1,33 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFqn = getFqn;
4
- const const_1 = require("../const");
1
+ import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_LITERAL_NAME } from "../const/index.js";
5
2
  /**
6
3
  * Get fqn name
7
4
  *
8
5
  * @param {FqnTarget} target - target (function, class, instance, enum, literal)
9
6
  * @return {string} - fully qualified name
10
7
  * */
11
- function getFqn(target) {
12
- var _a, _b, _c;
8
+ export function getFqn(target) {
13
9
  if (!target) {
14
10
  return undefined;
15
11
  }
16
12
  if (typeof target === 'function') { // function, class
17
- return (_a = target[const_1.KEY_FQN_NAME]) !== null && _a !== void 0 ? _a : target.name;
13
+ return target[KEY_FQN_NAME] ?? target.name;
18
14
  }
19
15
  else if (typeof target === 'object') {
20
16
  if (Array.isArray(target)) {
21
- if (target[const_1.KEY_LITERAL_NAME]) {
22
- return (_b = target[const_1.KEY_FQN_NAME]) !== null && _b !== void 0 ? _b : target[const_1.KEY_LITERAL_NAME];
17
+ if (target[KEY_LITERAL_NAME]) {
18
+ return target[KEY_FQN_NAME] ?? target[KEY_LITERAL_NAME];
23
19
  }
24
20
  return undefined;
25
21
  }
26
- if (target[const_1.KEY_ENUM_NAME]) {
27
- return (_c = target[const_1.KEY_FQN_NAME]) !== null && _c !== void 0 ? _c : target[const_1.KEY_ENUM_NAME];
22
+ if (target[KEY_ENUM_NAME]) {
23
+ return target[KEY_FQN_NAME] ?? target[KEY_ENUM_NAME];
28
24
  }
29
25
  return target.constructor !== Object ? getFqn(target.constructor) : undefined;
30
26
  }
31
27
  return undefined;
32
28
  }
33
- //# sourceMappingURL=get-fqn.js.map
@@ -1,12 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getKey = getKey;
4
- exports.getSymbol = getSymbol;
5
- exports.getProp = getProp;
6
- const internal_1 = require("../internal");
7
- const test_case_1 = require("./test-case");
8
- const leyyo_fn_1 = require("./leyyo-fn");
9
- const where = `${internal_1.FQN}.GetProp`;
1
+ import { FQN } from "../internal.js";
2
+ import { testCase } from "./test-case.js";
3
+ import { $$get_leyyo_fn } from "./leyyo-fn.js";
4
+ const where = `${FQN}.GetProp`;
10
5
  let _leyyo;
11
6
  /**
12
7
  * Get target property
@@ -15,7 +10,7 @@ let _leyyo;
15
10
  * @param {string} key - key
16
11
  * @return {any}
17
12
  * */
18
- function getKey(target, key) {
13
+ export function getKey(target, key) {
19
14
  if (typeof key !== 'string') {
20
15
  return undefined;
21
16
  }
@@ -28,7 +23,7 @@ function getKey(target, key) {
28
23
  * @param {symbol} key - hidden key
29
24
  * @return {any}
30
25
  * */
31
- function getSymbol(target, key) {
26
+ export function getSymbol(target, key) {
32
27
  if (typeof key !== 'symbol') {
33
28
  return undefined;
34
29
  }
@@ -41,7 +36,7 @@ function getSymbol(target, key) {
41
36
  * @param {(symbol|string)} key - key
42
37
  * @return {any}
43
38
  * */
44
- function getProp(target, key) {
39
+ export function getProp(target, key) {
45
40
  if (!['symbol', 'string'].includes(typeof key)) {
46
41
  return undefined;
47
42
  }
@@ -50,14 +45,13 @@ function getProp(target, key) {
50
45
  }
51
46
  try {
52
47
  const prop = Object.getOwnPropertyDescriptor(target, key);
53
- return prop === null || prop === void 0 ? void 0 : prop.value;
48
+ return prop?.value;
54
49
  }
55
50
  catch (e) {
56
51
  if (!_leyyo) {
57
- _leyyo = (0, leyyo_fn_1.$$get_leyyo_fn)();
52
+ _leyyo = $$get_leyyo_fn();
58
53
  }
59
- new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, (0, test_case_1.testCase)(internal_1.FQN, 'ZZZ'), where).log(e);
54
+ new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN, 'ZZZ'), where).log(e);
60
55
  return undefined;
61
56
  }
62
57
  }
63
- //# sourceMappingURL=get-prop.js.map
@@ -1,4 +1,4 @@
1
- import { FqnTarget } from "./index.types";
1
+ import { FqnTarget } from "./index.types.js";
2
2
  /**
3
3
  * Get fqn name
4
4
  *
@@ -1,32 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasFqn = hasFqn;
4
- const const_1 = require("../const");
1
+ import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_LITERAL_NAME } from "../const/index.js";
5
2
  /**
6
3
  * Get fqn name
7
4
  *
8
5
  * @param {FqnTarget} target - target (function, class, instance, enum, literal)
9
6
  * @return {string} - fully qualified name
10
7
  * */
11
- function hasFqn(target) {
8
+ export function hasFqn(target) {
12
9
  if (!target) {
13
10
  return false;
14
11
  }
15
12
  if (typeof target === 'function') { // function, class
16
- return !!target[const_1.KEY_FQN_NAME];
13
+ return !!target[KEY_FQN_NAME];
17
14
  }
18
15
  else if (typeof target === 'object') {
19
16
  if (Array.isArray(target)) {
20
- if (target[const_1.KEY_LITERAL_NAME]) {
21
- return !!target[const_1.KEY_FQN_NAME];
17
+ if (target[KEY_LITERAL_NAME]) {
18
+ return !!target[KEY_FQN_NAME];
22
19
  }
23
20
  return false;
24
21
  }
25
- if (target[const_1.KEY_ENUM_NAME]) {
26
- return !!target[const_1.KEY_FQN_NAME];
22
+ if (target[KEY_ENUM_NAME]) {
23
+ return !!target[KEY_FQN_NAME];
27
24
  }
28
25
  return target.constructor !== Object ? hasFqn(target.constructor) : false;
29
26
  }
30
27
  return false;
31
28
  }
32
- //# sourceMappingURL=has-fqn.js.map
@@ -1,28 +1,38 @@
1
- export * from './index.types';
2
- export * from './delay';
3
- export * from './delete-prop';
4
- export * from './empty.fn';
5
- export * from './extended-type';
6
- export * from './get-fqn';
7
- export * from './set-fqn';
8
- export * from './remove-fqn';
9
- export * from './on-fqn-set';
10
- export * from './set-anonymous-fqn';
11
- export * from './get-prop';
12
- export * from './has-fqn';
13
- export * from './is.fn';
14
- export * from './is-anonymous-name';
15
- export * from './jitter-interval';
16
- export * from './define-loader';
17
- export * from './stamp-loader';
18
- export * from './one-or-more';
19
- export * from './opt.fn';
20
- export * from './run-exporter';
21
- export * from './secure-clone';
22
- export * from './secure-json';
23
- export * from './set-anonymous-name';
24
- export * from './set-prop';
25
- export * from './test-case';
26
- export * from './test-name';
27
- export * from './random-test-no';
28
- export * from './is-test';
1
+ export * from './index.types.js';
2
+ export * from './delay.js';
3
+ export * from './delete-prop.js';
4
+ export * from './empty-fn.js';
5
+ export * from './extended-type.js';
6
+ export * from './get-fqn.js';
7
+ export * from './set-fqn.js';
8
+ export * from './remove-fqn.js';
9
+ export * from './on-fqn-set.js';
10
+ export * from './set-anonymous-fqn.js';
11
+ export * from './get-prop.js';
12
+ export * from './has-fqn.js';
13
+ export * from './is-class.js';
14
+ export * from './is-empty.js';
15
+ export * from './is-filled-arr.js';
16
+ export * from './is-filled-obj.js';
17
+ export * from './is-obj.js';
18
+ export * from './is-text.js';
19
+ export * from './is-anonymous-name.js';
20
+ export * from './jitter-interval.js';
21
+ export * from './define-loader.js';
22
+ export * from './stamp-loader.js';
23
+ export * from './one-or-more.js';
24
+ export * from './opt-add.js';
25
+ export * from './opt-append.js';
26
+ export * from './opt-check.js';
27
+ export * from './opt-clone.js';
28
+ export * from './opt-field.js';
29
+ export * from './opt-fn.js';
30
+ export * from './run-exporter.js';
31
+ export * from './secure-clone.js';
32
+ export * from './secure-json.js';
33
+ export * from './set-anonymous-name.js';
34
+ export * from './set-prop.js';
35
+ export * from './test-case.js';
36
+ export * from './test-name.js';
37
+ export * from './random-test-no.js';
38
+ export * from './is-test.js';
@@ -1,45 +1,38 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./index.types"), exports);
18
- __exportStar(require("./delay"), exports);
19
- __exportStar(require("./delete-prop"), exports);
20
- __exportStar(require("./empty.fn"), exports);
21
- __exportStar(require("./extended-type"), exports);
22
- __exportStar(require("./get-fqn"), exports);
23
- __exportStar(require("./set-fqn"), exports);
24
- __exportStar(require("./remove-fqn"), exports);
25
- __exportStar(require("./on-fqn-set"), exports);
26
- __exportStar(require("./set-anonymous-fqn"), exports);
27
- __exportStar(require("./get-prop"), exports);
28
- __exportStar(require("./has-fqn"), exports);
29
- __exportStar(require("./is.fn"), exports);
30
- __exportStar(require("./is-anonymous-name"), exports);
31
- __exportStar(require("./jitter-interval"), exports);
32
- __exportStar(require("./define-loader"), exports);
33
- __exportStar(require("./stamp-loader"), exports);
34
- __exportStar(require("./one-or-more"), exports);
35
- __exportStar(require("./opt.fn"), exports);
36
- __exportStar(require("./run-exporter"), exports);
37
- __exportStar(require("./secure-clone"), exports);
38
- __exportStar(require("./secure-json"), exports);
39
- __exportStar(require("./set-anonymous-name"), exports);
40
- __exportStar(require("./set-prop"), exports);
41
- __exportStar(require("./test-case"), exports);
42
- __exportStar(require("./test-name"), exports);
43
- __exportStar(require("./random-test-no"), exports);
44
- __exportStar(require("./is-test"), exports);
45
- //# sourceMappingURL=index.js.map
1
+ export * from './index.types.js';
2
+ export * from './delay.js';
3
+ export * from './delete-prop.js';
4
+ export * from './empty-fn.js';
5
+ export * from './extended-type.js';
6
+ export * from './get-fqn.js';
7
+ export * from './set-fqn.js';
8
+ export * from './remove-fqn.js';
9
+ export * from './on-fqn-set.js';
10
+ export * from './set-anonymous-fqn.js';
11
+ export * from './get-prop.js';
12
+ export * from './has-fqn.js';
13
+ export * from './is-class.js';
14
+ export * from './is-empty.js';
15
+ export * from './is-filled-arr.js';
16
+ export * from './is-filled-obj.js';
17
+ export * from './is-obj.js';
18
+ export * from './is-text.js';
19
+ export * from './is-anonymous-name.js';
20
+ export * from './jitter-interval.js';
21
+ export * from './define-loader.js';
22
+ export * from './stamp-loader.js';
23
+ export * from './one-or-more.js';
24
+ export * from './opt-add.js';
25
+ export * from './opt-append.js';
26
+ export * from './opt-check.js';
27
+ export * from './opt-clone.js';
28
+ export * from './opt-field.js';
29
+ export * from './opt-fn.js';
30
+ export * from './run-exporter.js';
31
+ export * from './secure-clone.js';
32
+ export * from './secure-json.js';
33
+ export * from './set-anonymous-name.js';
34
+ export * from './set-prop.js';
35
+ export * from './test-case.js';
36
+ export * from './test-name.js';
37
+ export * from './random-test-no.js';
38
+ export * from './is-test.js';
@@ -1,5 +1,5 @@
1
- import { ClassLike, Describable, ExtendedType, Fnc, Obj, OneOrMore, SetOrMore } from "../base";
2
- import { Enum, Literal } from "../common";
1
+ import { ClassLike, Describable, ExtendedType, Fnc, Obj, OneOrMore, SetOrMore } from "../base/index.js";
2
+ import { Enum, Literal } from "../common/index.js";
3
3
  export type FqnTarget = ClassLike | Fnc | Obj | Enum | Literal;
4
4
  export type FqnOnSetLambda = (full: string) => void;
5
5
  export type LoaderLike = Array<LoaderItem>;
@@ -1,4 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  // endregion exporter
4
- //# sourceMappingURL=index.types.js.map
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAnonymousName = isAnonymousName;
4
- const const_1 = require("../const");
5
- function isAnonymousName(name) {
1
+ import { VAL_NAME_ANONYMOUS } from "../const/index.js";
2
+ export function isAnonymousName(name) {
6
3
  if (typeof name === 'string') {
7
- return name.trim().startsWith(const_1.VAL_NAME_ANONYMOUS);
4
+ return name.trim().startsWith(VAL_NAME_ANONYMOUS);
8
5
  }
9
6
  return false;
10
7
  }
11
- //# sourceMappingURL=is-anonymous-name.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Is class?
3
+ *
4
+ * @param {any} fn - given value
5
+ * @return {boolean} - is class?
6
+ * */
7
+ export declare function isClass(fn: unknown): boolean;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Is class?
3
+ *
4
+ * @param {any} fn - given value
5
+ * @return {boolean} - is class?
6
+ * */
7
+ export function isClass(fn) {
8
+ // Class constructor is also a function
9
+ if (!(fn && fn.constructor === Function) || fn.prototype === undefined) {
10
+ return false;
11
+ }
12
+ // This is a class that extends other class
13
+ if (Function.prototype !== Object.getPrototypeOf(fn)) {
14
+ return true;
15
+ }
16
+ // Usually a function will only have 'constructor' in the prototype
17
+ return Object.getOwnPropertyNames(fn.prototype).length > 1;
18
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Is empty?
3
+ * Means:
4
+ * - `not null`
5
+ * - `not undefined`
6
+ * - `not empty string`
7
+ *
8
+ * @param {any} value - given value
9
+ * @param {boolean?} notSpace - yes: ignore empty string
10
+ * @return {boolean} - is empty?
11
+ * */
12
+ export declare function isEmpty(value: unknown, notSpace?: boolean): boolean;
@@ -0,0 +1,18 @@
1
+ import { EMPTY_VALUES } from "../const/index.js";
2
+ /**
3
+ * Is empty?
4
+ * Means:
5
+ * - `not null`
6
+ * - `not undefined`
7
+ * - `not empty string`
8
+ *
9
+ * @param {any} value - given value
10
+ * @param {boolean?} notSpace - yes: ignore empty string
11
+ * @return {boolean} - is empty?
12
+ * */
13
+ export function isEmpty(value, notSpace) {
14
+ if (notSpace) {
15
+ return EMPTY_VALUES.includes(value);
16
+ }
17
+ return EMPTY_VALUES.includes(value) || (typeof value === 'string' && !value.trim());
18
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Is filled array?
3
+ * Means
4
+ * - `constructor === "Array"`
5
+ * - `arr.length > 0`
6
+ *
7
+ * @param {any} arr - given value
8
+ * @return {boolean} - is filled array?
9
+ * */
10
+ export declare function isFilledArr(arr: unknown): boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Is filled array?
3
+ * Means
4
+ * - `constructor === "Array"`
5
+ * - `arr.length > 0`
6
+ *
7
+ * @param {any} arr - given value
8
+ * @return {boolean} - is filled array?
9
+ * */
10
+ export function isFilledArr(arr) {
11
+ return Array.isArray(arr) && arr.length > 0;
12
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Is filled object?
3
+ * Means:
4
+ * - `constructor === "Object"`
5
+ * - `obj.keys.length > 0`
6
+ *
7
+ * @param {any} obj - given value
8
+ * @return {boolean} - is filled object?
9
+ * */
10
+ export declare function isFilledObj(obj: unknown): boolean;
@@ -0,0 +1,13 @@
1
+ import { isObj } from "./is-obj.js";
2
+ /**
3
+ * Is filled object?
4
+ * Means:
5
+ * - `constructor === "Object"`
6
+ * - `obj.keys.length > 0`
7
+ *
8
+ * @param {any} obj - given value
9
+ * @return {boolean} - is filled object?
10
+ * */
11
+ export function isFilledObj(obj) {
12
+ return isObj(obj) && Object.keys(obj).length > 0;
13
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Is bare object?
3
+ * Means:
4
+ * - `constructor === "Object"`
5
+ *
6
+ * @param {any} obj - given value
7
+ * @return {boolean} - is bare object?
8
+ * */
9
+ export declare function isObj(obj: unknown): boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Is bare object?
3
+ * Means:
4
+ * - `constructor === "Object"`
5
+ *
6
+ * @param {any} obj - given value
7
+ * @return {boolean} - is bare object?
8
+ * */
9
+ export function isObj(obj) {
10
+ return obj && typeof obj === 'object' && !Array.isArray(obj);
11
+ }
@@ -1,8 +1,4 @@
1
- "use strict";
2
1
  // noinspection JSUnusedGlobalSymbols
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.initTest = initTest;
5
- exports.isTest = isTest;
6
2
  // region properties
7
3
  /**
8
4
  * Is test?
@@ -12,7 +8,7 @@ let _isTest;
12
8
  /**
13
9
  * Initialize test
14
10
  * */
15
- function initTest() {
11
+ export function initTest() {
16
12
  _isTest = true;
17
13
  if (global) {
18
14
  if (!global.leyyo_is_testing) {
@@ -31,7 +27,6 @@ function initTest() {
31
27
  *
32
28
  * @return {boolean}
33
29
  * */
34
- function isTest() {
30
+ export function isTest() {
35
31
  return _isTest;
36
32
  }
37
- //# sourceMappingURL=is-test.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Is text?
3
+ * Means:
4
+ * - `typeof === "string"`
5
+ * - `not empty string`
6
+ * - `not starts/ends with space`
7
+ *
8
+ * @param {any} str - given value
9
+ * @return {boolean} - is text?
10
+ * */
11
+ export declare function isText(str: unknown): boolean;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Is text?
3
+ * Means:
4
+ * - `typeof === "string"`
5
+ * - `not empty string`
6
+ * - `not starts/ends with space`
7
+ *
8
+ * @param {any} str - given value
9
+ * @return {boolean} - is text?
10
+ * */
11
+ export function isText(str) {
12
+ if (typeof str !== 'string') {
13
+ return false;
14
+ }
15
+ const val = str.trim();
16
+ return val && val === str;
17
+ }
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jitterInterval = jitterInterval;
4
1
  // noinspection JSUnusedGlobalSymbols
5
2
  /**
6
3
  * Generate next delay time with exponential & randomized manner
@@ -11,14 +8,14 @@ exports.jitterInterval = jitterInterval;
11
8
  * @param {number} maxTryCount - max try count, if `tryCount` excess it, it returns undefined
12
9
  * @return {number} - next interval time if (maxTryCount && `tryCount` >= `maxTryCount`)
13
10
  * */
14
- function jitterInterval(tryCount, baseDelay, maxDelay, maxTryCount) {
11
+ export function jitterInterval(tryCount, baseDelay, maxDelay, maxTryCount) {
15
12
  if ([tryCount, baseDelay, maxDelay].some(v => !isValid(v))) {
16
13
  return undefined;
17
14
  }
18
15
  if (isValid(maxTryCount) && tryCount >= maxTryCount) {
19
16
  return undefined;
20
17
  }
21
- const exp = Math.min(baseDelay * Math.pow(2, tryCount), maxDelay);
18
+ const exp = Math.min(baseDelay * 2 ** tryCount, maxDelay);
22
19
  const result = Math.floor(exp / 2 + Math.random() * (exp / 2));
23
20
  return Number.isSafeInteger(result) ? result : undefined;
24
21
  }
@@ -31,4 +28,3 @@ function jitterInterval(tryCount, baseDelay, maxDelay, maxTryCount) {
31
28
  function isValid(value) {
32
29
  return typeof value === 'number' && value > 0 && Number.isInteger(value) && Number.isSafeInteger(value);
33
30
  }
34
- //# sourceMappingURL=jitter-interval.js.map
@@ -1,3 +1,3 @@
1
- import { LeyyoLike } from "../base";
1
+ import { LeyyoLike } from "../base/index.js";
2
2
  export declare function $$set_leyyo_fn(leyyo: LeyyoLike): void;
3
3
  export declare function $$get_leyyo_fn(): LeyyoLike;
@@ -1,14 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.$$set_leyyo_fn = $$set_leyyo_fn;
4
- exports.$$get_leyyo_fn = $$get_leyyo_fn;
5
1
  let _leyyo;
6
- function $$set_leyyo_fn(leyyo) {
2
+ export function $$set_leyyo_fn(leyyo) {
7
3
  if (!_leyyo && leyyo) {
8
4
  _leyyo = leyyo;
9
5
  }
10
6
  }
11
- function $$get_leyyo_fn() {
7
+ export function $$get_leyyo_fn() {
12
8
  return _leyyo;
13
9
  }
14
- //# sourceMappingURL=leyyo-fn.js.map
@@ -1,2 +1,2 @@
1
- import { FqnOnSetLambda, FqnTarget } from "./index.types";
1
+ import { FqnOnSetLambda, FqnTarget } from "./index.types.js";
2
2
  export declare function onFqnSet(target: FqnTarget, callback: FqnOnSetLambda): boolean;