@jblib/is 0.0.2 → 0.0.4

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 (86) hide show
  1. package/dist/index.d.ts +13 -1
  2. package/dist/index.js +13 -1
  3. package/dist/is-array.d.ts +21 -0
  4. package/dist/is-array.d.ts.map +1 -0
  5. package/dist/is-array.js +22 -0
  6. package/dist/is-array.js.map +1 -0
  7. package/dist/is-boolean.d.ts +21 -0
  8. package/dist/is-boolean.d.ts.map +1 -0
  9. package/dist/is-boolean.js +22 -0
  10. package/dist/is-boolean.js.map +1 -0
  11. package/dist/is-date.d.ts +21 -0
  12. package/dist/is-date.d.ts.map +1 -0
  13. package/dist/is-date.js +22 -0
  14. package/dist/is-date.js.map +1 -0
  15. package/dist/is-defined.d.ts +19 -0
  16. package/dist/is-defined.d.ts.map +1 -0
  17. package/dist/is-defined.js +20 -0
  18. package/dist/is-defined.js.map +1 -0
  19. package/dist/is-empty-object.d.ts +23 -0
  20. package/dist/is-empty-object.d.ts.map +1 -0
  21. package/dist/is-empty-object.js +26 -0
  22. package/dist/is-empty-object.js.map +1 -0
  23. package/dist/is-error.d.ts +20 -0
  24. package/dist/is-error.d.ts.map +1 -0
  25. package/dist/is-error.js +21 -0
  26. package/dist/is-error.js.map +1 -0
  27. package/dist/is-function.d.ts +20 -0
  28. package/dist/is-function.d.ts.map +1 -0
  29. package/dist/is-function.js +21 -0
  30. package/dist/is-function.js.map +1 -0
  31. package/dist/is-nil.d.ts +21 -0
  32. package/dist/is-nil.d.ts.map +1 -0
  33. package/dist/is-nil.js +22 -0
  34. package/dist/is-nil.js.map +1 -0
  35. package/dist/is-non-empty-array.d.ts +19 -0
  36. package/dist/is-non-empty-array.d.ts.map +1 -0
  37. package/dist/is-non-empty-array.js +20 -0
  38. package/dist/is-non-empty-array.js.map +1 -0
  39. package/dist/is-number.d.ts +10 -3
  40. package/dist/is-number.d.ts.map +1 -1
  41. package/dist/is-number.js +10 -3
  42. package/dist/is-number.js.map +1 -1
  43. package/dist/is-object.d.ts +20 -0
  44. package/dist/is-object.d.ts.map +1 -0
  45. package/dist/is-object.js +21 -0
  46. package/dist/is-object.js.map +1 -0
  47. package/dist/is-plain-object.d.ts +22 -0
  48. package/dist/is-plain-object.d.ts.map +1 -0
  49. package/dist/is-plain-object.js +27 -0
  50. package/dist/is-plain-object.js.map +1 -0
  51. package/dist/is-primitive.d.ts +27 -0
  52. package/dist/is-primitive.d.ts.map +1 -0
  53. package/dist/is-primitive.js +24 -0
  54. package/dist/is-primitive.js.map +1 -0
  55. package/dist/is-string.d.ts +10 -3
  56. package/dist/is-string.d.ts.map +1 -1
  57. package/dist/is-string.js +10 -3
  58. package/dist/is-string.js.map +1 -1
  59. package/package.json +4 -4
  60. package/src/index.ts +14 -4
  61. package/src/is-array.spec.ts +18 -0
  62. package/src/is-array.ts +19 -0
  63. package/src/is-boolean.spec.ts +18 -0
  64. package/src/is-boolean.ts +19 -0
  65. package/src/is-date.spec.ts +21 -0
  66. package/src/is-date.ts +19 -0
  67. package/src/is-defined.spec.ts +15 -0
  68. package/src/is-defined.ts +17 -0
  69. package/src/is-empty-object.spec.ts +25 -0
  70. package/src/is-empty-object.ts +24 -0
  71. package/src/is-error.spec.ts +19 -0
  72. package/src/is-error.ts +18 -0
  73. package/src/is-function.spec.ts +35 -0
  74. package/src/is-function.ts +18 -0
  75. package/src/is-nil.spec.ts +17 -0
  76. package/src/is-nil.ts +19 -0
  77. package/src/is-non-empty-array.spec.ts +21 -0
  78. package/src/is-non-empty-array.ts +17 -0
  79. package/src/is-number.ts +10 -3
  80. package/src/is-object.spec.ts +17 -0
  81. package/src/is-object.ts +18 -0
  82. package/src/is-plain-object.spec.ts +18 -0
  83. package/src/is-plain-object.ts +28 -0
  84. package/src/is-primitive.spec.ts +23 -0
  85. package/src/is-primitive.ts +26 -0
  86. package/src/is-string.ts +10 -3
package/dist/index.d.ts CHANGED
@@ -1,3 +1,15 @@
1
+ import { isArray } from "./is-array.js";
2
+ import { isBoolean } from "./is-boolean.js";
3
+ import { isDate } from "./is-date.js";
4
+ import { isDefined } from "./is-defined.js";
5
+ import { isEmptyObject } from "./is-empty-object.js";
6
+ import { isError } from "./is-error.js";
7
+ import { isFunction } from "./is-function.js";
8
+ import { isNil } from "./is-nil.js";
9
+ import { isNonEmptyArray } from "./is-non-empty-array.js";
1
10
  import { isNumber } from "./is-number.js";
11
+ import { isObject } from "./is-object.js";
12
+ import { isPlainObject } from "./is-plain-object.js";
13
+ import { isPrimitive } from "./is-primitive.js";
2
14
  import { isString } from "./is-string.js";
3
- export { isNumber, isString };
15
+ export { isArray, isBoolean, isDate, isDefined, isEmptyObject, isError, isFunction, isNil, isNonEmptyArray, isNumber, isObject, isPlainObject, isPrimitive, isString };
package/dist/index.js CHANGED
@@ -1,4 +1,16 @@
1
+ import { isArray } from "./is-array.js";
2
+ import { isBoolean } from "./is-boolean.js";
3
+ import { isDate } from "./is-date.js";
4
+ import { isDefined } from "./is-defined.js";
5
+ import { isPlainObject } from "./is-plain-object.js";
6
+ import { isEmptyObject } from "./is-empty-object.js";
7
+ import { isError } from "./is-error.js";
8
+ import { isFunction } from "./is-function.js";
9
+ import { isNil } from "./is-nil.js";
10
+ import { isNonEmptyArray } from "./is-non-empty-array.js";
1
11
  import { isNumber } from "./is-number.js";
12
+ import { isObject } from "./is-object.js";
13
+ import { isPrimitive } from "./is-primitive.js";
2
14
  import { isString } from "./is-string.js";
3
15
 
4
- export { isNumber, isString };
16
+ export { isArray, isBoolean, isDate, isDefined, isEmptyObject, isError, isFunction, isNil, isNonEmptyArray, isNumber, isObject, isPlainObject, isPrimitive, isString };
@@ -0,0 +1,21 @@
1
+ //#region src/is-array.d.ts
2
+ /**
3
+ * isArray checks if the provided value is an array.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is unknown[]} returns true if the value is an array or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isArray([]) // true
11
+ * isArray([1, 2, 3]) // true
12
+ * isArray('hello') // false
13
+ * isArray({}) // false
14
+ * isArray(123) // false
15
+ * isArray(undefined) // false
16
+ * ```
17
+ */
18
+ declare const isArray: (v: unknown) => v is unknown[];
19
+ //#endregion
20
+ export { isArray };
21
+ //# sourceMappingURL=is-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-array.d.ts","names":[],"sources":["../src/is-array.ts"],"mappings":";;;;;;;;;;;;;;;;;cAgBM,OAAA,GAAW,CAAA,cAAa,CAAA"}
@@ -0,0 +1,22 @@
1
+ //#region src/is-array.ts
2
+ /**
3
+ * isArray checks if the provided value is an array.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is unknown[]} returns true if the value is an array or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isArray([]) // true
11
+ * isArray([1, 2, 3]) // true
12
+ * isArray('hello') // false
13
+ * isArray({}) // false
14
+ * isArray(123) // false
15
+ * isArray(undefined) // false
16
+ * ```
17
+ */
18
+ const isArray = (v) => Array.isArray(v);
19
+
20
+ //#endregion
21
+ export { isArray };
22
+ //# sourceMappingURL=is-array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-array.js","names":[],"sources":["../src/is-array.ts"],"sourcesContent":["/**\n * isArray checks if the provided value is an array.\n *\n * @param v value to check.\n * @returns {v is unknown[]} returns true if the value is an array or otherwise false.\n *\n * @example\n * ```ts\n * isArray([]) // true\n * isArray([1, 2, 3]) // true\n * isArray('hello') // false\n * isArray({}) // false\n * isArray(123) // false\n * isArray(undefined) // false\n * ```\n */\nconst isArray = (v: unknown): v is unknown[] => Array.isArray(v)\n\nexport { isArray }\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAM,WAAW,MAA+B,MAAM,QAAQ,EAAE"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-boolean.d.ts
2
+ /**
3
+ * isBoolean checks if a value is a boolean.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is boolean} returns true if the value is a boolean or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isBoolean(true) // true
11
+ * isBoolean(false) // true
12
+ * isBoolean('hello') // false
13
+ * isBoolean(42) // false
14
+ * isBoolean(null) // false
15
+ * isBoolean(undefined) // false
16
+ * ```
17
+ */
18
+ declare const isBoolean: (v: unknown) => v is boolean;
19
+ //#endregion
20
+ export { isBoolean };
21
+ //# sourceMappingURL=is-boolean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-boolean.d.ts","names":[],"sources":["../src/is-boolean.ts"],"mappings":";;;;;;;;;;;;;;;;;cAgBM,SAAA,GAAa,CAAA,cAAa,CAAA"}
@@ -0,0 +1,22 @@
1
+ //#region src/is-boolean.ts
2
+ /**
3
+ * isBoolean checks if a value is a boolean.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is boolean} returns true if the value is a boolean or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isBoolean(true) // true
11
+ * isBoolean(false) // true
12
+ * isBoolean('hello') // false
13
+ * isBoolean(42) // false
14
+ * isBoolean(null) // false
15
+ * isBoolean(undefined) // false
16
+ * ```
17
+ */
18
+ const isBoolean = (v) => typeof v === "boolean";
19
+
20
+ //#endregion
21
+ export { isBoolean };
22
+ //# sourceMappingURL=is-boolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-boolean.js","names":[],"sources":["../src/is-boolean.ts"],"sourcesContent":["/**\n * isBoolean checks if a value is a boolean.\n *\n * @param v value to check.\n * @returns {v is boolean} returns true if the value is a boolean or otherwise false.\n *\n * @example\n * ```ts\n * isBoolean(true) // true\n * isBoolean(false) // true\n * isBoolean('hello') // false\n * isBoolean(42) // false\n * isBoolean(null) // false\n * isBoolean(undefined) // false\n * ```\n */\nconst isBoolean = (v: unknown): v is boolean => typeof v === 'boolean'\n\nexport { isBoolean }\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAM,aAAa,MAA6B,OAAO,MAAM"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-date.d.ts
2
+ /**
3
+ * isDate checks if the value is an instance of Date and is a valid date.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v instanceof Date} returns true if the value is an instance of Date and is a valid date or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isDate(new Date()) // true
11
+ * isDate(new Date('invalid date')) // false
12
+ * isDate('2022-01-01') // false
13
+ * isDate(1640995200000) // false
14
+ * isDate(null) // false
15
+ * isDate(undefined) // false
16
+ * ```
17
+ */
18
+ declare const isDate: (v: unknown) => v is Date;
19
+ //#endregion
20
+ export { isDate };
21
+ //# sourceMappingURL=is-date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-date.d.ts","names":[],"sources":["../src/is-date.ts"],"mappings":";;;;;;;;;;;;;;;;;cAgBM,MAAA,GAAU,CAAA,cAAa,CAAA,IAAK,IAAA"}
@@ -0,0 +1,22 @@
1
+ //#region src/is-date.ts
2
+ /**
3
+ * isDate checks if the value is an instance of Date and is a valid date.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v instanceof Date} returns true if the value is an instance of Date and is a valid date or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isDate(new Date()) // true
11
+ * isDate(new Date('invalid date')) // false
12
+ * isDate('2022-01-01') // false
13
+ * isDate(1640995200000) // false
14
+ * isDate(null) // false
15
+ * isDate(undefined) // false
16
+ * ```
17
+ */
18
+ const isDate = (v) => v instanceof Date && !isNaN(v.getTime());
19
+
20
+ //#endregion
21
+ export { isDate };
22
+ //# sourceMappingURL=is-date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-date.js","names":[],"sources":["../src/is-date.ts"],"sourcesContent":["/**\n * isDate checks if the value is an instance of Date and is a valid date.\n *\n * @param v value to check.\n * @returns {v instanceof Date} returns true if the value is an instance of Date and is a valid date or otherwise false.\n *\n * @example\n * ```ts\n * isDate(new Date()) // true\n * isDate(new Date('invalid date')) // false\n * isDate('2022-01-01') // false\n * isDate(1640995200000) // false\n * isDate(null) // false\n * isDate(undefined) // false\n * ```\n */\nconst isDate = (v: unknown): v is Date => v instanceof Date && !isNaN(v.getTime())\n\nexport { isDate }\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAM,UAAU,MAA0B,aAAa,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC"}
@@ -0,0 +1,19 @@
1
+ //#region src/is-defined.d.ts
2
+ /**
3
+ * isDefined checks if a value is not null or undefined.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is T} returns true if the value is defined (not null or undefined) or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isDefined(42) // true
11
+ * isDefined('hello') // true
12
+ * isDefined(null) // false
13
+ * isDefined(undefined) // false
14
+ * ```
15
+ */
16
+ declare const isDefined: <T>(v: T | null | undefined) => v is T;
17
+ //#endregion
18
+ export { isDefined };
19
+ //# sourceMappingURL=is-defined.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-defined.d.ts","names":[],"sources":["../src/is-defined.ts"],"mappings":";;;;;;;;;;;;;;;cAcM,SAAA,MAAgB,CAAA,EAAG,CAAA,wBAAuB,CAAA,IAAK,CAAA"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-defined.ts
2
+ /**
3
+ * isDefined checks if a value is not null or undefined.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is T} returns true if the value is defined (not null or undefined) or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isDefined(42) // true
11
+ * isDefined('hello') // true
12
+ * isDefined(null) // false
13
+ * isDefined(undefined) // false
14
+ * ```
15
+ */
16
+ const isDefined = (v) => v !== null && v !== void 0;
17
+
18
+ //#endregion
19
+ export { isDefined };
20
+ //# sourceMappingURL=is-defined.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-defined.js","names":[],"sources":["../src/is-defined.ts"],"sourcesContent":["/**\n * isDefined checks if a value is not null or undefined.\n *\n * @param v value to check.\n * @returns {v is T} returns true if the value is defined (not null or undefined) or otherwise false.\n *\n * @example\n * ```ts\n * isDefined(42) // true\n * isDefined('hello') // true\n * isDefined(null) // false\n * isDefined(undefined) // false\n * ```\n */\nconst isDefined = <T>(v: T | null | undefined): v is T => v !== null && v !== undefined\n\nexport { isDefined }\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,aAAgB,MAAoC,MAAM,QAAQ,MAAM"}
@@ -0,0 +1,23 @@
1
+ //#region src/is-empty-object.d.ts
2
+ /**
3
+ * isEmptyObject checks if a value is an empty object, that is,
4
+ * a plain object with no own properties.
5
+ *
6
+ * @param v value to check.
7
+ * @returns {v is Record<PropertyKey, never>} returns true if the value is an empty object or otherwise false.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * isEmptyObject({}) // true
12
+ * isEmptyObject(Object.create(null)) // true
13
+ * isEmptyObject({ a: 1 }) // false
14
+ * isEmptyObject([]) // false
15
+ * isEmptyObject(null) // false
16
+ * isEmptyObject('hello') // false
17
+ * isEmptyObject(42) // false
18
+ * ```
19
+ */
20
+ declare const isEmptyObject: (v: unknown) => v is Record<PropertyKey, never>;
21
+ //#endregion
22
+ export { isEmptyObject };
23
+ //# sourceMappingURL=is-empty-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty-object.d.ts","names":[],"sources":["../src/is-empty-object.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAoBM,aAAA,GAAiB,CAAA,cAAa,CAAA,IAAK,MAAA,CAAO,WAAA"}
@@ -0,0 +1,26 @@
1
+ import { isPlainObject } from "./is-plain-object.js";
2
+
3
+ //#region src/is-empty-object.ts
4
+ /**
5
+ * isEmptyObject checks if a value is an empty object, that is,
6
+ * a plain object with no own properties.
7
+ *
8
+ * @param v value to check.
9
+ * @returns {v is Record<PropertyKey, never>} returns true if the value is an empty object or otherwise false.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * isEmptyObject({}) // true
14
+ * isEmptyObject(Object.create(null)) // true
15
+ * isEmptyObject({ a: 1 }) // false
16
+ * isEmptyObject([]) // false
17
+ * isEmptyObject(null) // false
18
+ * isEmptyObject('hello') // false
19
+ * isEmptyObject(42) // false
20
+ * ```
21
+ */
22
+ const isEmptyObject = (v) => isPlainObject(v) && Reflect.ownKeys(v).length === 0;
23
+
24
+ //#endregion
25
+ export { isEmptyObject };
26
+ //# sourceMappingURL=is-empty-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty-object.js","names":[],"sources":["../src/is-empty-object.ts"],"sourcesContent":["import { isPlainObject } from './is-plain-object.js'\n\n/**\n * isEmptyObject checks if a value is an empty object, that is,\n * a plain object with no own properties.\n *\n * @param v value to check.\n * @returns {v is Record<PropertyKey, never>} returns true if the value is an empty object or otherwise false.\n *\n * @example\n * ```ts\n * isEmptyObject({}) // true\n * isEmptyObject(Object.create(null)) // true\n * isEmptyObject({ a: 1 }) // false\n * isEmptyObject([]) // false\n * isEmptyObject(null) // false\n * isEmptyObject('hello') // false\n * isEmptyObject(42) // false\n * ```\n */\nconst isEmptyObject = (v: unknown): v is Record<PropertyKey, never> =>\n isPlainObject(v) && Reflect.ownKeys(v).length === 0\n\nexport { isEmptyObject }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,iBAAiB,MACrB,cAAc,EAAE,IAAI,QAAQ,QAAQ,EAAE,CAAC,WAAW"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-error.d.ts
2
+ /**
3
+ * isError checks if the value is an instance of Error.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is Error} returns true if the value is an instance of Error or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isError(new Error()) // true
11
+ * isError('hello') // false
12
+ * isError({}) // false
13
+ * isError(123) // false
14
+ * isError(null) // false
15
+ * ```
16
+ */
17
+ declare const isError: (v: unknown) => v is Error;
18
+ //#endregion
19
+ export { isError };
20
+ //# sourceMappingURL=is-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-error.d.ts","names":[],"sources":["../src/is-error.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,OAAA,GAAW,CAAA,cAAa,CAAA,IAAK,KAAA"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-error.ts
2
+ /**
3
+ * isError checks if the value is an instance of Error.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is Error} returns true if the value is an instance of Error or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isError(new Error()) // true
11
+ * isError('hello') // false
12
+ * isError({}) // false
13
+ * isError(123) // false
14
+ * isError(null) // false
15
+ * ```
16
+ */
17
+ const isError = (v) => v instanceof Error;
18
+
19
+ //#endregion
20
+ export { isError };
21
+ //# sourceMappingURL=is-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-error.js","names":[],"sources":["../src/is-error.ts"],"sourcesContent":["/**\n * isError checks if the value is an instance of Error.\n *\n * @param v value to check.\n * @returns {v is Error} returns true if the value is an instance of Error or otherwise false.\n *\n * @example\n * ```ts\n * isError(new Error()) // true\n * isError('hello') // false\n * isError({}) // false\n * isError(123) // false\n * isError(null) // false\n * ```\n */\nconst isError = (v: unknown): v is Error => v instanceof Error\n\nexport { isError }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,WAAW,MAA2B,aAAa"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-function.d.ts
2
+ /**
3
+ * isFunction checks if the provided value is a function.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is (...args: unknown[]) => unknown} returns true if v is a function or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isFunction(() => {}) // true
11
+ * isFunction(function() {}) // true
12
+ * isFunction(async function() {}) // true
13
+ * isFunction('hello') // false
14
+ * isFunction({}) // false
15
+ * ```
16
+ */
17
+ declare const isFunction: (v: unknown) => v is (...args: unknown[]) => unknown;
18
+ //#endregion
19
+ export { isFunction };
20
+ //# sourceMappingURL=is-function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-function.d.ts","names":[],"sources":["../src/is-function.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,UAAA,GAAc,CAAA,cAAa,CAAA,QAAS,IAAA"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-function.ts
2
+ /**
3
+ * isFunction checks if the provided value is a function.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is (...args: unknown[]) => unknown} returns true if v is a function or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isFunction(() => {}) // true
11
+ * isFunction(function() {}) // true
12
+ * isFunction(async function() {}) // true
13
+ * isFunction('hello') // false
14
+ * isFunction({}) // false
15
+ * ```
16
+ */
17
+ const isFunction = (v) => typeof v === "function";
18
+
19
+ //#endregion
20
+ export { isFunction };
21
+ //# sourceMappingURL=is-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-function.js","names":[],"sources":["../src/is-function.ts"],"sourcesContent":["/**\n * isFunction checks if the provided value is a function.\n *\n * @param v value to check.\n * @returns {v is (...args: unknown[]) => unknown} returns true if v is a function or otherwise false.\n *\n * @example\n * ```ts\n * isFunction(() => {}) // true\n * isFunction(function() {}) // true\n * isFunction(async function() {}) // true\n * isFunction('hello') // false\n * isFunction({}) // false\n * ```\n */\nconst isFunction = (v: unknown): v is (...args: unknown[]) => unknown => typeof v === 'function'\n\nexport { isFunction }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,cAAc,MAAqD,OAAO,MAAM"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-nil.d.ts
2
+ /**
3
+ * isNil checks if a value is null or undefined.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is null | undefined} returns true if the value is null or undefined or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isNil(null) // true
11
+ * isNil(undefined) // true
12
+ * isNil(42) // false
13
+ * isNil('hello') // false
14
+ * isNil({}) // false
15
+ * isNil([]) // false
16
+ * ```
17
+ */
18
+ declare const isNil: (v: unknown) => v is null | undefined;
19
+ //#endregion
20
+ export { isNil };
21
+ //# sourceMappingURL=is-nil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-nil.d.ts","names":[],"sources":["../src/is-nil.ts"],"mappings":";;;;;;;;;;;;;;;;;cAgBM,KAAA,GAAS,CAAA,cAAa,CAAA"}
package/dist/is-nil.js ADDED
@@ -0,0 +1,22 @@
1
+ //#region src/is-nil.ts
2
+ /**
3
+ * isNil checks if a value is null or undefined.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is null | undefined} returns true if the value is null or undefined or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isNil(null) // true
11
+ * isNil(undefined) // true
12
+ * isNil(42) // false
13
+ * isNil('hello') // false
14
+ * isNil({}) // false
15
+ * isNil([]) // false
16
+ * ```
17
+ */
18
+ const isNil = (v) => v === null || v === void 0;
19
+
20
+ //#endregion
21
+ export { isNil };
22
+ //# sourceMappingURL=is-nil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-nil.js","names":[],"sources":["../src/is-nil.ts"],"sourcesContent":["/**\n * isNil checks if a value is null or undefined.\n *\n * @param v value to check.\n * @returns {v is null | undefined} returns true if the value is null or undefined or otherwise false.\n *\n * @example\n * ```ts\n * isNil(null) // true\n * isNil(undefined) // true\n * isNil(42) // false\n * isNil('hello') // false\n * isNil({}) // false\n * isNil([]) // false\n * ```\n */\nconst isNil = (v: unknown): v is null | undefined => v === null || v === undefined\n\nexport { isNil }\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAM,SAAS,MAAsC,MAAM,QAAQ,MAAM"}
@@ -0,0 +1,19 @@
1
+ //#region src/is-non-empty-array.d.ts
2
+ /**
3
+ * isNonEmptyArray checks if the provided value is an array and contains at least one element.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is unknown[]} returns true if v is a non-empty array or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isNonEmptyArray([1, 2, 3]) // true
11
+ * isNonEmptyArray([]) // false
12
+ * isNonEmptyArray('hello') // false
13
+ * isNonEmptyArray({}) // false
14
+ * ```
15
+ */
16
+ declare const isNonEmptyArray: (v: unknown) => v is unknown[];
17
+ //#endregion
18
+ export { isNonEmptyArray };
19
+ //# sourceMappingURL=is-non-empty-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-non-empty-array.d.ts","names":[],"sources":["../src/is-non-empty-array.ts"],"mappings":";;;;;;;;;;;;;;;cAcM,eAAA,GAAmB,CAAA,cAAa,CAAA"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-non-empty-array.ts
2
+ /**
3
+ * isNonEmptyArray checks if the provided value is an array and contains at least one element.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is unknown[]} returns true if v is a non-empty array or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isNonEmptyArray([1, 2, 3]) // true
11
+ * isNonEmptyArray([]) // false
12
+ * isNonEmptyArray('hello') // false
13
+ * isNonEmptyArray({}) // false
14
+ * ```
15
+ */
16
+ const isNonEmptyArray = (v) => Array.isArray(v) && v.length > 0;
17
+
18
+ //#endregion
19
+ export { isNonEmptyArray };
20
+ //# sourceMappingURL=is-non-empty-array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-non-empty-array.js","names":[],"sources":["../src/is-non-empty-array.ts"],"sourcesContent":["/**\n * isNonEmptyArray checks if the provided value is an array and contains at least one element.\n *\n * @param v value to check.\n * @returns {v is unknown[]} returns true if v is a non-empty array or otherwise false.\n *\n * @example\n * ```ts\n * isNonEmptyArray([1, 2, 3]) // true\n * isNonEmptyArray([]) // false\n * isNonEmptyArray('hello') // false\n * isNonEmptyArray({}) // false\n * ```\n */\nconst isNonEmptyArray = (v: unknown): v is unknown[] => Array.isArray(v) && v.length > 0\n\nexport { isNonEmptyArray }\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,mBAAmB,MAA+B,MAAM,QAAQ,EAAE,IAAI,EAAE,SAAS"}
@@ -1,9 +1,16 @@
1
1
  //#region src/is-number.d.ts
2
2
  /**
3
- * Checks if a value is a number.
3
+ * isNumber checks if the provided value is a number.
4
4
  *
5
- * @param v value to check
6
- * @returns boolean indicating if the value is a number
5
+ * @param v value to check.
6
+ * @returns {v is number} returns true if v is a number or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isNumber(123) // true
11
+ * isNumber('hello') // false
12
+ * isNumber({}) // false
13
+ * ```
7
14
  */
8
15
  declare const isNumber: (v: unknown) => v is number;
9
16
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"is-number.d.ts","names":[],"sources":["../src/is-number.ts"],"mappings":";;;;;;;cAMM,QAAA,GAAY,CAAA,cAAa,CAAA"}
1
+ {"version":3,"file":"is-number.d.ts","names":[],"sources":["../src/is-number.ts"],"mappings":";;;;;;;;;;;;;;cAaM,QAAA,GAAY,CAAA,cAAa,CAAA"}
package/dist/is-number.js CHANGED
@@ -1,9 +1,16 @@
1
1
  //#region src/is-number.ts
2
2
  /**
3
- * Checks if a value is a number.
3
+ * isNumber checks if the provided value is a number.
4
4
  *
5
- * @param v value to check
6
- * @returns boolean indicating if the value is a number
5
+ * @param v value to check.
6
+ * @returns {v is number} returns true if v is a number or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isNumber(123) // true
11
+ * isNumber('hello') // false
12
+ * isNumber({}) // false
13
+ * ```
7
14
  */
8
15
  const isNumber = (v) => typeof v === "number";
9
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"is-number.js","names":[],"sources":["../src/is-number.ts"],"sourcesContent":["/**\n * Checks if a value is a number.\n *\n * @param v value to check\n * @returns boolean indicating if the value is a number\n */\nconst isNumber = (v: unknown): v is number => typeof v === 'number'\n\nexport { isNumber }\n"],"mappings":";;;;;;;AAMA,MAAM,YAAY,MAA4B,OAAO,MAAM"}
1
+ {"version":3,"file":"is-number.js","names":[],"sources":["../src/is-number.ts"],"sourcesContent":["/**\n * isNumber checks if the provided value is a number.\n *\n * @param v value to check.\n * @returns {v is number} returns true if v is a number or otherwise false.\n *\n * @example\n * ```ts\n * isNumber(123) // true\n * isNumber('hello') // false\n * isNumber({}) // false\n * ```\n */\nconst isNumber = (v: unknown): v is number => typeof v === 'number'\n\nexport { isNumber }\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,YAAY,MAA4B,OAAO,MAAM"}
@@ -0,0 +1,20 @@
1
+ //#region src/is-object.d.ts
2
+ /**
3
+ * isObject checks if the value is an object.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is object} returns true if the value is an object or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isObject({}) // true
11
+ * isObject([]) // true
12
+ * isObject(null) // false
13
+ * isObject('hello') // false
14
+ * isObject(42) // false
15
+ * ```
16
+ */
17
+ declare const isObject: (v: unknown) => v is object;
18
+ //#endregion
19
+ export { isObject };
20
+ //# sourceMappingURL=is-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-object.d.ts","names":[],"sources":["../src/is-object.ts"],"mappings":";;;;;;;;;;;;;;;;cAeM,QAAA,GAAY,CAAA,cAAa,CAAA"}
@@ -0,0 +1,21 @@
1
+ //#region src/is-object.ts
2
+ /**
3
+ * isObject checks if the value is an object.
4
+ *
5
+ * @param v value to check.
6
+ * @returns {v is object} returns true if the value is an object or otherwise false.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * isObject({}) // true
11
+ * isObject([]) // true
12
+ * isObject(null) // false
13
+ * isObject('hello') // false
14
+ * isObject(42) // false
15
+ * ```
16
+ */
17
+ const isObject = (v) => typeof v === "object" && v !== null;
18
+
19
+ //#endregion
20
+ export { isObject };
21
+ //# sourceMappingURL=is-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-object.js","names":[],"sources":["../src/is-object.ts"],"sourcesContent":["/**\n * isObject checks if the value is an object.\n *\n * @param v value to check.\n * @returns {v is object} returns true if the value is an object or otherwise false.\n *\n * @example\n * ```ts\n * isObject({}) // true\n * isObject([]) // true\n * isObject(null) // false\n * isObject('hello') // false\n * isObject(42) // false\n * ```\n */\nconst isObject = (v: unknown): v is object => typeof v === 'object' && v !== null\n\nexport { isObject }\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,YAAY,MAA4B,OAAO,MAAM,YAAY,MAAM"}
@@ -0,0 +1,22 @@
1
+ //#region src/is-plain-object.d.ts
2
+ /**
3
+ * isPlainObject checks if a value is a plain object, that is,
4
+ * an object created by the Object constructor or with a null prototype.
5
+ *
6
+ * @param v value to check.
7
+ * @returns {v is Record<PropertyKey, unknown>} returns true if the value is a plain object or otherwise false.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * isPlainObject({}) // true
12
+ * isPlainObject(Object.create(null)) // true
13
+ * isPlainObject([]) // false
14
+ * isPlainObject(null) // false
15
+ * isPlainObject('hello') // false
16
+ * isPlainObject(42) // false
17
+ * ```
18
+ */
19
+ declare const isPlainObject: (v: unknown) => v is Record<PropertyKey, unknown>;
20
+ //#endregion
21
+ export { isPlainObject };
22
+ //# sourceMappingURL=is-plain-object.d.ts.map