@jblib/is 0.0.5 → 0.0.7

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 (76) hide show
  1. package/dist/index.d.ts +13 -1
  2. package/dist/index.js +13 -1
  3. package/dist/is-empty-array.d.ts +19 -0
  4. package/dist/is-empty-array.d.ts.map +1 -0
  5. package/dist/is-empty-array.js +20 -0
  6. package/dist/is-empty-array.js.map +1 -0
  7. package/dist/is-falsy.d.ts +30 -0
  8. package/dist/is-falsy.d.ts.map +1 -0
  9. package/dist/is-falsy.js +30 -0
  10. package/dist/is-falsy.js.map +1 -0
  11. package/dist/is-map.d.ts +20 -0
  12. package/dist/is-map.d.ts.map +1 -0
  13. package/dist/is-map.js +21 -0
  14. package/dist/is-map.js.map +1 -0
  15. package/dist/is-negative-number.d.ts +20 -0
  16. package/dist/is-negative-number.d.ts.map +1 -0
  17. package/dist/is-negative-number.js +23 -0
  18. package/dist/is-negative-number.js.map +1 -0
  19. package/dist/is-null.d.ts +20 -0
  20. package/dist/is-null.d.ts.map +1 -0
  21. package/dist/is-null.js +21 -0
  22. package/dist/is-null.js.map +1 -0
  23. package/dist/is-positive-number.d.ts +20 -0
  24. package/dist/is-positive-number.d.ts.map +1 -0
  25. package/dist/is-positive-number.js +23 -0
  26. package/dist/is-positive-number.js.map +1 -0
  27. package/dist/is-promise.d.ts +20 -0
  28. package/dist/is-promise.d.ts.map +1 -0
  29. package/dist/is-promise.js +21 -0
  30. package/dist/is-promise.js.map +1 -0
  31. package/dist/is-reg-exp.d.ts +23 -0
  32. package/dist/is-reg-exp.d.ts.map +1 -0
  33. package/dist/is-reg-exp.js +24 -0
  34. package/dist/is-reg-exp.js.map +1 -0
  35. package/dist/is-set.d.ts +20 -0
  36. package/dist/is-set.d.ts.map +1 -0
  37. package/dist/is-set.js +21 -0
  38. package/dist/is-set.js.map +1 -0
  39. package/dist/is-symbol.d.ts +20 -0
  40. package/dist/is-symbol.d.ts.map +1 -0
  41. package/dist/is-symbol.js +21 -0
  42. package/dist/is-symbol.js.map +1 -0
  43. package/dist/is-truthy.d.ts +31 -0
  44. package/dist/is-truthy.d.ts.map +1 -0
  45. package/dist/is-truthy.js +30 -0
  46. package/dist/is-truthy.js.map +1 -0
  47. package/dist/is-undefined.d.ts +20 -0
  48. package/dist/is-undefined.d.ts.map +1 -0
  49. package/dist/is-undefined.js +21 -0
  50. package/dist/is-undefined.js.map +1 -0
  51. package/package.json +1 -1
  52. package/src/index.ts +12 -0
  53. package/src/is-empty-array.spec.ts +21 -0
  54. package/src/is-empty-array.ts +17 -0
  55. package/src/is-falsy.spec.ts +22 -0
  56. package/src/is-falsy.ts +31 -0
  57. package/src/is-map.spec.ts +17 -0
  58. package/src/is-map.ts +18 -0
  59. package/src/is-negative-number.spec.ts +15 -0
  60. package/src/is-negative-number.ts +20 -0
  61. package/src/is-null.spec.ts +17 -0
  62. package/src/is-null.ts +18 -0
  63. package/src/is-positive-number.spec.ts +15 -0
  64. package/src/is-positive-number.ts +20 -0
  65. package/src/is-promise.spec.ts +27 -0
  66. package/src/is-promise.ts +22 -0
  67. package/src/is-reg-exp.spec.ts +19 -0
  68. package/src/is-reg-exp.ts +21 -0
  69. package/src/is-set.spec.ts +17 -0
  70. package/src/is-set.ts +18 -0
  71. package/src/is-symbol.spec.ts +18 -0
  72. package/src/is-symbol.ts +18 -0
  73. package/src/is-truthy.spec.ts +22 -0
  74. package/src/is-truthy.ts +29 -0
  75. package/src/is-undefined.spec.ts +29 -0
  76. package/src/is-undefined.ts +18 -0
package/dist/index.d.ts CHANGED
@@ -2,14 +2,26 @@ import { isArray } from "./is-array.js";
2
2
  import { isBoolean } from "./is-boolean.js";
3
3
  import { isDate } from "./is-date.js";
4
4
  import { isDefined } from "./is-defined.js";
5
+ import { isEmptyArray } from "./is-empty-array.js";
5
6
  import { isEmptyObject } from "./is-empty-object.js";
6
7
  import { isError } from "./is-error.js";
8
+ import { isFalsy } from "./is-falsy.js";
7
9
  import { isFunction } from "./is-function.js";
10
+ import { isMap } from "./is-map.js";
11
+ import { isNegativeNumber } from "./is-negative-number.js";
8
12
  import { isNil } from "./is-nil.js";
9
13
  import { isNonEmptyArray } from "./is-non-empty-array.js";
14
+ import { isNull } from "./is-null.js";
10
15
  import { isNumber } from "./is-number.js";
11
16
  import { isObject } from "./is-object.js";
12
17
  import { isPlainObject } from "./is-plain-object.js";
18
+ import { isPositiveNumber } from "./is-positive-number.js";
13
19
  import { isPrimitive } from "./is-primitive.js";
20
+ import { isPromise } from "./is-promise.js";
21
+ import { isRegExp } from "./is-reg-exp.js";
22
+ import { isSet } from "./is-set.js";
14
23
  import { isString } from "./is-string.js";
15
- export { isArray, isBoolean, isDate, isDefined, isEmptyObject, isError, isFunction, isNil, isNonEmptyArray, isNumber, isObject, isPlainObject, isPrimitive, isString };
24
+ import { isSymbol } from "./is-symbol.js";
25
+ import { isTruthy } from "./is-truthy.js";
26
+ import { isUndefined } from "./is-undefined.js";
27
+ export { isArray, isBoolean, isDate, isDefined, isEmptyArray, isEmptyObject, isError, isFalsy, isFunction, isMap, isNegativeNumber, isNil, isNonEmptyArray, isNull, isNumber, isObject, isPlainObject, isPositiveNumber, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isUndefined };
package/dist/index.js CHANGED
@@ -2,15 +2,27 @@ import { isArray } from "./is-array.js";
2
2
  import { isBoolean } from "./is-boolean.js";
3
3
  import { isDate } from "./is-date.js";
4
4
  import { isDefined } from "./is-defined.js";
5
+ import { isEmptyArray } from "./is-empty-array.js";
5
6
  import { isPlainObject } from "./is-plain-object.js";
6
7
  import { isEmptyObject } from "./is-empty-object.js";
7
8
  import { isError } from "./is-error.js";
9
+ import { isFalsy } from "./is-falsy.js";
8
10
  import { isFunction } from "./is-function.js";
11
+ import { isMap } from "./is-map.js";
12
+ import { isNegativeNumber } from "./is-negative-number.js";
9
13
  import { isNil } from "./is-nil.js";
10
14
  import { isNonEmptyArray } from "./is-non-empty-array.js";
15
+ import { isNull } from "./is-null.js";
11
16
  import { isNumber } from "./is-number.js";
12
17
  import { isObject } from "./is-object.js";
18
+ import { isPositiveNumber } from "./is-positive-number.js";
13
19
  import { isPrimitive } from "./is-primitive.js";
20
+ import { isPromise } from "./is-promise.js";
21
+ import { isRegExp } from "./is-reg-exp.js";
22
+ import { isSet } from "./is-set.js";
14
23
  import { isString } from "./is-string.js";
24
+ import { isSymbol } from "./is-symbol.js";
25
+ import { isTruthy } from "./is-truthy.js";
26
+ import { isUndefined } from "./is-undefined.js";
15
27
 
16
- export { isArray, isBoolean, isDate, isDefined, isEmptyObject, isError, isFunction, isNil, isNonEmptyArray, isNumber, isObject, isPlainObject, isPrimitive, isString };
28
+ export { isArray, isBoolean, isDate, isDefined, isEmptyArray, isEmptyObject, isError, isFalsy, isFunction, isMap, isNegativeNumber, isNil, isNonEmptyArray, isNull, isNumber, isObject, isPlainObject, isPositiveNumber, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isUndefined };
@@ -0,0 +1,19 @@
1
+ //#region src/is-empty-array.d.ts
2
+ /**
3
+ * isEmptyArray checks if the value is an empty array.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is unknown[]} returns true if v is an empty array or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isEmptyArray([]) // true
11
+ * isEmptyArray([1, 2, 3]) // false
12
+ * isEmptyArray('hello') // false
13
+ * isEmptyArray({}) // false
14
+ * ```
15
+ */
16
+ declare const isEmptyArray: (v: unknown) => v is unknown[];
17
+ //#endregion
18
+ export { isEmptyArray };
19
+ //# sourceMappingURL=is-empty-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty-array.d.ts","names":[],"sources":["../src/is-empty-array.ts"],"mappings":";;;;;;;;;;;;;;;cAcM,YAAA,GAAgB,CAAA,cAAa,CAAA"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-empty-array.ts
2
+ /**
3
+ * isEmptyArray checks if the value is an empty array.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is unknown[]} returns true if v is an empty array or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isEmptyArray([]) // true
11
+ * isEmptyArray([1, 2, 3]) // false
12
+ * isEmptyArray('hello') // false
13
+ * isEmptyArray({}) // false
14
+ * ```
15
+ */
16
+ const isEmptyArray = (v) => Array.isArray(v) && v.length === 0;
17
+
18
+ //#endregion
19
+ export { isEmptyArray };
20
+ //# sourceMappingURL=is-empty-array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty-array.js","names":[],"sources":["../src/is-empty-array.ts"],"sourcesContent":["/**\n * isEmptyArray checks if the value is an empty array.\n *\n * @param v value to check.\n * @returns {v is unknown[]} returns true if v is an empty array or otherwise false.\n *\n * @example\n * ```ts\n * isEmptyArray([]) // true\n * isEmptyArray([1, 2, 3]) // false\n * isEmptyArray('hello') // false\n * isEmptyArray({}) // false\n * ```\n */\nconst isEmptyArray = (v: unknown): v is unknown[] => Array.isArray(v) && v.length === 0\n\nexport { isEmptyArray }\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,gBAAgB,MAA+B,MAAM,QAAQ,EAAE,IAAI,EAAE,WAAW"}
@@ -0,0 +1,30 @@
1
+ //#region src/is-falsy.d.ts
2
+ type Falsy = false | 0 | 0n | '' | null | undefined;
3
+ /**
4
+ * isFalsy checks if a value is falsy.
5
+ * A value is considered falsy if it is false, 0, 0n, '', null, or undefined.
6
+ * Useful for type narrowing in conditional statements.
7
+ * See isTruthy for the opposite of isFalsy.
8
+ *
9
+ * @param v value to check.
10
+ * @returns {v is Extract<T, Falsy>} returns true if v is falsy or otherwise false.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * isFalsy(false) // true
15
+ * isFalsy(0) // true
16
+ * isFalsy(0n) // true
17
+ * isFalsy('') // true
18
+ * isFalsy(null) // true
19
+ * isFalsy(undefined) // true
20
+ * isFalsy(true) // false
21
+ * isFalsy(1) // false
22
+ * isFalsy('hello') // false
23
+ * isFalsy([]) // false
24
+ * isFalsy({}) // false
25
+ * ```
26
+ */
27
+ declare const isFalsy: <T>(v: T) => v is Extract<T, Falsy>;
28
+ //#endregion
29
+ export { type Falsy, isFalsy };
30
+ //# sourceMappingURL=is-falsy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-falsy.d.ts","names":[],"sources":["../src/is-falsy.ts"],"mappings":";KAAK,KAAA;;;;;;AAAK;;;;;;;;;;;;;;;;;;;cA0BJ,OAAA,MAAc,CAAA,EAAG,CAAA,KAAI,CAAA,IAAK,OAAA,CAAQ,CAAA,EAAG,KAAA"}
@@ -0,0 +1,30 @@
1
+ //#region src/is-falsy.ts
2
+ /**
3
+ * isFalsy checks if a value is falsy.
4
+ * A value is considered falsy if it is false, 0, 0n, '', null, or undefined.
5
+ * Useful for type narrowing in conditional statements.
6
+ * See isTruthy for the opposite of isFalsy.
7
+ *
8
+ * @param v value to check.
9
+ * @returns {v is Extract<T, Falsy>} returns true if v is falsy or otherwise false.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * isFalsy(false) // true
14
+ * isFalsy(0) // true
15
+ * isFalsy(0n) // true
16
+ * isFalsy('') // true
17
+ * isFalsy(null) // true
18
+ * isFalsy(undefined) // true
19
+ * isFalsy(true) // false
20
+ * isFalsy(1) // false
21
+ * isFalsy('hello') // false
22
+ * isFalsy([]) // false
23
+ * isFalsy({}) // false
24
+ * ```
25
+ */
26
+ const isFalsy = (v) => !v;
27
+
28
+ //#endregion
29
+ export { isFalsy };
30
+ //# sourceMappingURL=is-falsy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-falsy.js","names":[],"sources":["../src/is-falsy.ts"],"sourcesContent":["type Falsy = false | 0 | 0n | '' | null | undefined\n\n/**\n * isFalsy checks if a value is falsy.\n * A value is considered falsy if it is false, 0, 0n, '', null, or undefined.\n * Useful for type narrowing in conditional statements.\n * See isTruthy for the opposite of isFalsy.\n *\n * @param v value to check.\n * @returns {v is Extract<T, Falsy>} returns true if v is falsy or otherwise false.\n *\n * @example\n * ```ts\n * isFalsy(false) // true\n * isFalsy(0) // true\n * isFalsy(0n) // true\n * isFalsy('') // true\n * isFalsy(null) // true\n * isFalsy(undefined) // true\n * isFalsy(true) // false\n * isFalsy(1) // false\n * isFalsy('hello') // false\n * isFalsy([]) // false\n * isFalsy({}) // false\n * ```\n */\nconst isFalsy = <T>(v: T): v is Extract<T, Falsy> => !v\n\nexport type { Falsy }\n\nexport { isFalsy }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,WAAc,MAAiC,CAAC"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-map.d.ts
2
+ /**
3
+ * isMap checks if a value is a Map.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is Map<unknown, unknown>} returns true if v is a Map or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isMap(new Map()) // true
11
+ * isMap(new Set()) // false
12
+ * isMap([]) // false
13
+ * isMap({}) // false
14
+ * isMap('hello') // false
15
+ * ```
16
+ */
17
+ declare const isMap: (v: unknown) => v is Map<unknown, unknown>;
18
+ //#endregion
19
+ export { isMap };
20
+ //# sourceMappingURL=is-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-map.d.ts","names":[],"sources":["../src/is-map.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,KAAA,GAAS,CAAA,cAAa,CAAA,IAAK,GAAA"}
package/dist/is-map.js ADDED
@@ -0,0 +1,21 @@
1
+ //#region src/is-map.ts
2
+ /**
3
+ * isMap checks if a value is a Map.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is Map<unknown, unknown>} returns true if v is a Map or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isMap(new Map()) // true
11
+ * isMap(new Set()) // false
12
+ * isMap([]) // false
13
+ * isMap({}) // false
14
+ * isMap('hello') // false
15
+ * ```
16
+ */
17
+ const isMap = (v) => v instanceof Map;
18
+
19
+ //#endregion
20
+ export { isMap };
21
+ //# sourceMappingURL=is-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-map.js","names":[],"sources":["../src/is-map.ts"],"sourcesContent":["/**\n * isMap checks if a value is a Map.\n *\n * @param v value to check.\n * @returns {v is Map<unknown, unknown>} returns true if v is a Map or otherwise false.\n *\n * @example\n * ```ts\n * isMap(new Map()) // true\n * isMap(new Set()) // false\n * isMap([]) // false\n * isMap({}) // false\n * isMap('hello') // false\n * ```\n */\nconst isMap = (v: unknown): v is Map<unknown, unknown> => v instanceof Map\n\nexport { isMap }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,SAAS,MAA2C,aAAa"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-negative-number.d.ts
2
+ /**
3
+ * isNegativeNumber checks if a value is a negative number.
4
+ * Note that zero is not considered a negative number.
5
+ *
6
+ * @param v value to check.
7
+ * @returns {v is number} returns true if v is a negative number or otherwise false.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * isNegativeNumber(-5) // true
12
+ * isNegativeNumber(5) // false
13
+ * isNegativeNumber(0) // false
14
+ * isNegativeNumber('hello') // false
15
+ * ```
16
+ */
17
+ declare const isNegativeNumber: (v: unknown) => v is number;
18
+ //#endregion
19
+ export { isNegativeNumber };
20
+ //# sourceMappingURL=is-negative-number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-negative-number.d.ts","names":[],"sources":["../src/is-negative-number.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,gBAAA,GAAoB,CAAA,cAAa,CAAA"}
@@ -0,0 +1,23 @@
1
+ //#region src/is-negative-number.ts
2
+ /**
3
+ * isNegativeNumber checks if a value is a negative number.
4
+ * Note that zero is not considered a negative number.
5
+ *
6
+ * @param v value to check.
7
+ * @returns {v is number} returns true if v is a negative number or otherwise false.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * isNegativeNumber(-5) // true
12
+ * isNegativeNumber(5) // false
13
+ * isNegativeNumber(0) // false
14
+ * isNegativeNumber('hello') // false
15
+ * ```
16
+ */
17
+ const isNegativeNumber = (v) => {
18
+ return typeof v === "number" && v < 0;
19
+ };
20
+
21
+ //#endregion
22
+ export { isNegativeNumber };
23
+ //# sourceMappingURL=is-negative-number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-negative-number.js","names":[],"sources":["../src/is-negative-number.ts"],"sourcesContent":["/**\n * isNegativeNumber checks if a value is a negative number.\n * Note that zero is not considered a negative number.\n *\n * @param v value to check.\n * @returns {v is number} returns true if v is a negative number or otherwise false.\n *\n * @example\n * ```ts\n * isNegativeNumber(-5) // true\n * isNegativeNumber(5) // false\n * isNegativeNumber(0) // false\n * isNegativeNumber('hello') // false\n * ```\n */\nconst isNegativeNumber = (v: unknown): v is number => {\n return typeof v === 'number' && v < 0\n}\n\nexport { isNegativeNumber }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,oBAAoB,MAA4B;AACpD,QAAO,OAAO,MAAM,YAAY,IAAI"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-null.d.ts
2
+ /**
3
+ * isNull checks if a value is null.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is null} returns true if v is null or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isNull(null) // true
11
+ * isNull('hello') // false
12
+ * isNull(123) // false
13
+ * isNull({}) // false
14
+ * isNull([]) // false
15
+ * ```
16
+ */
17
+ declare const isNull: (v: unknown) => v is null;
18
+ //#endregion
19
+ export { isNull };
20
+ //# sourceMappingURL=is-null.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-null.d.ts","names":[],"sources":["../src/is-null.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,MAAA,GAAU,CAAA,cAAa,CAAA"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-null.ts
2
+ /**
3
+ * isNull checks if a value is null.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is null} returns true if v is null or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isNull(null) // true
11
+ * isNull('hello') // false
12
+ * isNull(123) // false
13
+ * isNull({}) // false
14
+ * isNull([]) // false
15
+ * ```
16
+ */
17
+ const isNull = (v) => v === null;
18
+
19
+ //#endregion
20
+ export { isNull };
21
+ //# sourceMappingURL=is-null.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-null.js","names":[],"sources":["../src/is-null.ts"],"sourcesContent":["/**\n * isNull checks if a value is null.\n *\n * @param v value to check.\n * @returns {v is null} returns true if v is null or otherwise false.\n *\n * @example\n * ```ts\n * isNull(null) // true\n * isNull('hello') // false\n * isNull(123) // false\n * isNull({}) // false\n * isNull([]) // false\n * ```\n */\nconst isNull = (v: unknown): v is null => v === null\n\nexport { isNull }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,UAAU,MAA0B,MAAM"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-positive-number.d.ts
2
+ /**
3
+ * isPositiveNumber checks if a value is a positive number.
4
+ * Note that zero is not considered a positive number.
5
+ *
6
+ * @param value value to check.
7
+ * @returns {value is number} returns true if value is a positive number or otherwise false.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * isPositiveNumber(5) // true
12
+ * isPositiveNumber(-5) // false
13
+ * isPositiveNumber(0) // false
14
+ * isPositiveNumber('hello') // false
15
+ * ```
16
+ */
17
+ declare const isPositiveNumber: (value: unknown) => value is number;
18
+ //#endregion
19
+ export { isPositiveNumber };
20
+ //# sourceMappingURL=is-positive-number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-positive-number.d.ts","names":[],"sources":["../src/is-positive-number.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,gBAAA,GAAoB,KAAA,cAAiB,KAAA"}
@@ -0,0 +1,23 @@
1
+ //#region src/is-positive-number.ts
2
+ /**
3
+ * isPositiveNumber checks if a value is a positive number.
4
+ * Note that zero is not considered a positive number.
5
+ *
6
+ * @param value value to check.
7
+ * @returns {value is number} returns true if value is a positive number or otherwise false.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * isPositiveNumber(5) // true
12
+ * isPositiveNumber(-5) // false
13
+ * isPositiveNumber(0) // false
14
+ * isPositiveNumber('hello') // false
15
+ * ```
16
+ */
17
+ const isPositiveNumber = (value) => {
18
+ return typeof value === "number" && value > 0;
19
+ };
20
+
21
+ //#endregion
22
+ export { isPositiveNumber };
23
+ //# sourceMappingURL=is-positive-number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-positive-number.js","names":[],"sources":["../src/is-positive-number.ts"],"sourcesContent":["/**\n * isPositiveNumber checks if a value is a positive number.\n * Note that zero is not considered a positive number.\n *\n * @param value value to check.\n * @returns {value is number} returns true if value is a positive number or otherwise false.\n *\n * @example\n * ```ts\n * isPositiveNumber(5) // true\n * isPositiveNumber(-5) // false\n * isPositiveNumber(0) // false\n * isPositiveNumber('hello') // false\n * ```\n */\nconst isPositiveNumber = (value: unknown): value is number => {\n return typeof value === 'number' && value > 0\n}\n\nexport { isPositiveNumber }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,oBAAoB,UAAoC;AAC5D,QAAO,OAAO,UAAU,YAAY,QAAQ"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-promise.d.ts
2
+ /**
3
+ * isPromise checks if a value is a Promise.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is Promise<unknown>} returns true if v is a Promise or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isPromise(Promise.resolve()) // true
11
+ * isPromise(new Set()) // false
12
+ * isPromise([]) // false
13
+ * isPromise({}) // false
14
+ * isPromise('hello') // false
15
+ * ```
16
+ */
17
+ declare const isPromise: (v: unknown) => v is Promise<unknown>;
18
+ //#endregion
19
+ export { isPromise };
20
+ //# sourceMappingURL=is-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-promise.d.ts","names":[],"sources":["../src/is-promise.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,SAAA,GAAa,CAAA,cAAa,CAAA,IAAK,OAAA"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-promise.ts
2
+ /**
3
+ * isPromise checks if a value is a Promise.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is Promise<unknown>} returns true if v is a Promise or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isPromise(Promise.resolve()) // true
11
+ * isPromise(new Set()) // false
12
+ * isPromise([]) // false
13
+ * isPromise({}) // false
14
+ * isPromise('hello') // false
15
+ * ```
16
+ */
17
+ const isPromise = (v) => typeof v === "object" && v !== null && typeof v.then === "function" && typeof v.catch === "function";
18
+
19
+ //#endregion
20
+ export { isPromise };
21
+ //# sourceMappingURL=is-promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-promise.js","names":[],"sources":["../src/is-promise.ts"],"sourcesContent":["/**\n * isPromise checks if a value is a Promise.\n *\n * @param v value to check.\n * @returns {v is Promise<unknown>} returns true if v is a Promise or otherwise false.\n *\n * @example\n * ```ts\n * isPromise(Promise.resolve()) // true\n * isPromise(new Set()) // false\n * isPromise([]) // false\n * isPromise({}) // false\n * isPromise('hello') // false\n * ```\n */\nconst isPromise = (v: unknown): v is Promise<unknown> =>\n typeof v === 'object' &&\n v !== null &&\n typeof (v as Promise<unknown>).then === 'function' &&\n typeof (v as Promise<unknown>).catch === 'function'\n\nexport { isPromise }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,aAAa,MACjB,OAAO,MAAM,YACb,MAAM,QACN,OAAQ,EAAuB,SAAS,cACxC,OAAQ,EAAuB,UAAU"}
@@ -0,0 +1,23 @@
1
+ //#region src/is-reg-exp.d.ts
2
+ /**
3
+ * isRegExp checks if a value is a regular expression.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is RegExp} returns true if v is a RegExp or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isRegExp(/abc/) // true
11
+ * isRegExp(new RegExp('abc')) // true
12
+ * isRegExp('abc') // false
13
+ * isRegExp(123) // false
14
+ * isRegExp({}) // false
15
+ * isRegExp([]) // false
16
+ * isRegExp(null) // false
17
+ * isRegExp(undefined) // false
18
+ * ```
19
+ */
20
+ declare const isRegExp: (v: unknown) => v is RegExp;
21
+ //#endregion
22
+ export { isRegExp };
23
+ //# sourceMappingURL=is-reg-exp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-reg-exp.d.ts","names":[],"sources":["../src/is-reg-exp.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAkBM,QAAA,GAAY,CAAA,cAAa,CAAA,IAAK,MAAA"}
@@ -0,0 +1,24 @@
1
+ //#region src/is-reg-exp.ts
2
+ /**
3
+ * isRegExp checks if a value is a regular expression.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is RegExp} returns true if v is a RegExp or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isRegExp(/abc/) // true
11
+ * isRegExp(new RegExp('abc')) // true
12
+ * isRegExp('abc') // false
13
+ * isRegExp(123) // false
14
+ * isRegExp({}) // false
15
+ * isRegExp([]) // false
16
+ * isRegExp(null) // false
17
+ * isRegExp(undefined) // false
18
+ * ```
19
+ */
20
+ const isRegExp = (v) => v instanceof RegExp;
21
+
22
+ //#endregion
23
+ export { isRegExp };
24
+ //# sourceMappingURL=is-reg-exp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-reg-exp.js","names":[],"sources":["../src/is-reg-exp.ts"],"sourcesContent":["/**\n * isRegExp checks if a value is a regular expression.\n *\n * @param v value to check.\n * @returns {v is RegExp} returns true if v is a RegExp or otherwise false.\n *\n * @example\n * ```ts\n * isRegExp(/abc/) // true\n * isRegExp(new RegExp('abc')) // true\n * isRegExp('abc') // false\n * isRegExp(123) // false\n * isRegExp({}) // false\n * isRegExp([]) // false\n * isRegExp(null) // false\n * isRegExp(undefined) // false\n * ```\n */\nconst isRegExp = (v: unknown): v is RegExp => v instanceof RegExp\n\nexport { isRegExp }\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAM,YAAY,MAA4B,aAAa"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-set.d.ts
2
+ /**
3
+ * isSet checks if a value is a Set.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is Set<unknown>} returns true if v is a Set or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isSet(new Set()) // true
11
+ * isSet(new Map()) // false
12
+ * isSet([]) // false
13
+ * isSet({}) // false
14
+ * isSet('hello') // false
15
+ * ```
16
+ */
17
+ declare const isSet: (v: unknown) => v is Set<unknown>;
18
+ //#endregion
19
+ export { isSet };
20
+ //# sourceMappingURL=is-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-set.d.ts","names":[],"sources":["../src/is-set.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,KAAA,GAAS,CAAA,cAAa,CAAA,IAAK,GAAA"}
package/dist/is-set.js ADDED
@@ -0,0 +1,21 @@
1
+ //#region src/is-set.ts
2
+ /**
3
+ * isSet checks if a value is a Set.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is Set<unknown>} returns true if v is a Set or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isSet(new Set()) // true
11
+ * isSet(new Map()) // false
12
+ * isSet([]) // false
13
+ * isSet({}) // false
14
+ * isSet('hello') // false
15
+ * ```
16
+ */
17
+ const isSet = (v) => v instanceof Set;
18
+
19
+ //#endregion
20
+ export { isSet };
21
+ //# sourceMappingURL=is-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-set.js","names":[],"sources":["../src/is-set.ts"],"sourcesContent":["/**\n * isSet checks if a value is a Set.\n *\n * @param v value to check.\n * @returns {v is Set<unknown>} returns true if v is a Set or otherwise false.\n *\n * @example\n * ```ts\n * isSet(new Set()) // true\n * isSet(new Map()) // false\n * isSet([]) // false\n * isSet({}) // false\n * isSet('hello') // false\n * ```\n */\nconst isSet = (v: unknown): v is Set<unknown> => v instanceof Set\n\nexport { isSet }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,SAAS,MAAkC,aAAa"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-symbol.d.ts
2
+ /**
3
+ * isSymbol checks if a value is a symbol.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is symbol} returns true if v is a symbol or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isSymbol(Symbol('foo')) // true
11
+ * isSymbol('hello') // false
12
+ * isSymbol(123) // false
13
+ * isSymbol({}) // false
14
+ * isSymbol([]) // false
15
+ * ```
16
+ */
17
+ declare const isSymbol: (v: unknown) => v is symbol;
18
+ //#endregion
19
+ export { isSymbol };
20
+ //# sourceMappingURL=is-symbol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-symbol.d.ts","names":[],"sources":["../src/is-symbol.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,QAAA,GAAY,CAAA,cAAa,CAAA"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-symbol.ts
2
+ /**
3
+ * isSymbol checks if a value is a symbol.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is symbol} returns true if v is a symbol or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isSymbol(Symbol('foo')) // true
11
+ * isSymbol('hello') // false
12
+ * isSymbol(123) // false
13
+ * isSymbol({}) // false
14
+ * isSymbol([]) // false
15
+ * ```
16
+ */
17
+ const isSymbol = (v) => typeof v === "symbol";
18
+
19
+ //#endregion
20
+ export { isSymbol };
21
+ //# sourceMappingURL=is-symbol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-symbol.js","names":[],"sources":["../src/is-symbol.ts"],"sourcesContent":["/**\n * isSymbol checks if a value is a symbol.\n *\n * @param v value to check.\n * @returns {v is symbol} returns true if v is a symbol or otherwise false.\n *\n * @example\n * ```ts\n * isSymbol(Symbol('foo')) // true\n * isSymbol('hello') // false\n * isSymbol(123) // false\n * isSymbol({}) // false\n * isSymbol([]) // false\n * ```\n */\nconst isSymbol = (v: unknown): v is symbol => typeof v === 'symbol'\n\nexport { isSymbol }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,YAAY,MAA4B,OAAO,MAAM"}
@@ -0,0 +1,31 @@
1
+ import { Falsy } from "./is-falsy.js";
2
+
3
+ //#region src/is-truthy.d.ts
4
+ /**
5
+ * isTruthy checks if a value is truthy. A value is considered truthy if it is not falsy.
6
+ * Falsy values are false, 0, 0n, '', null, and undefined.
7
+ * Useful for type narrowing in conditional statements.
8
+ * See isFalsy for the opposite of isTruthy.
9
+ *
10
+ * @param v value to check.
11
+ * @returns {v is Exclude<T, Falsy>} returns true if v is truthy or otherwise false.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * isTruthy(true) // true
16
+ * isTruthy(1) // true
17
+ * isTruthy('hello') // true
18
+ * isTruthy([]) // true
19
+ * isTruthy({}) // true
20
+ * isTruthy(false) // false
21
+ * isTruthy(0) // false
22
+ * isTruthy(0n) // false
23
+ * isTruthy('') // false
24
+ * isTruthy(null) // false
25
+ * isTruthy(undefined) // false
26
+ * ```
27
+ */
28
+ declare const isTruthy: <T>(v: T) => v is Exclude<T, Falsy>;
29
+ //#endregion
30
+ export { isTruthy };
31
+ //# sourceMappingURL=is-truthy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-truthy.d.ts","names":[],"sources":["../src/is-truthy.ts"],"mappings":";;;;;AAA0C;;;;;;;;;;;;;;;;;;;;;;cA0BpC,QAAA,MAAe,CAAA,EAAG,CAAA,KAAI,CAAA,IAAK,OAAA,CAAQ,CAAA,EAAG,KAAA"}