@zinaid/utils 0.0.3 → 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.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -43
- package/dist/optional-require.d.ts +18 -0
- package/dist/optional-require.d.ts.map +1 -0
- package/dist/optional-require.js +13 -0
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { optionalRequire as s } from "./optional-require.js";
|
|
2
|
+
import { castableToArray as t, compareValues as o, entriesKeyValue as a, getAccessibleValues as l, isAccessibleData as n, isArray as b, isBoolean as u, isFalsy as c, isFiniteNumber as m, isFloat as p, isFunction as y, isInteger as A, isMap as N, isNegativeNumber as S, isNonPrimitive as g, isNull as F, isNumber as f, isObject as v, isObjectAny as T, isPositiveNumber as j, isPrimitive as O, isSet as q, isString as P, isStringable as V, isSymbol as d, isTruthy as h, isTruthyObject as k, isUndefined as w, isWeakMap as x, isWeakSet as z, looseEqual as D, lowerFirst as E, normalizeToArray as J, objectToString as M, resolveDefault as U, strictEqual as W, toArrayable as B, toJsonSerializable as I, toJsonable as K, toLower as L, toUpper as R, typeOf as C, upperFirst as G } from "./utils.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
t as castableToArray,
|
|
5
|
+
o as compareValues,
|
|
6
|
+
a as entriesKeyValue,
|
|
7
|
+
l as getAccessibleValues,
|
|
8
|
+
n as isAccessibleData,
|
|
9
|
+
b as isArray,
|
|
10
|
+
u as isBoolean,
|
|
11
|
+
c as isFalsy,
|
|
12
|
+
m as isFiniteNumber,
|
|
13
|
+
p as isFloat,
|
|
13
14
|
y as isFunction,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
U as
|
|
39
|
-
W as
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
C as
|
|
15
|
+
A as isInteger,
|
|
16
|
+
N as isMap,
|
|
17
|
+
S as isNegativeNumber,
|
|
18
|
+
g as isNonPrimitive,
|
|
19
|
+
F as isNull,
|
|
20
|
+
f as isNumber,
|
|
21
|
+
v as isObject,
|
|
22
|
+
T as isObjectAny,
|
|
23
|
+
j as isPositiveNumber,
|
|
24
|
+
O as isPrimitive,
|
|
25
|
+
q as isSet,
|
|
26
|
+
P as isString,
|
|
27
|
+
V as isStringable,
|
|
28
|
+
d as isSymbol,
|
|
29
|
+
h as isTruthy,
|
|
30
|
+
k as isTruthyObject,
|
|
31
|
+
w as isUndefined,
|
|
32
|
+
x as isWeakMap,
|
|
33
|
+
z as isWeakSet,
|
|
34
|
+
D as looseEqual,
|
|
35
|
+
E as lowerFirst,
|
|
36
|
+
J as normalizeToArray,
|
|
37
|
+
M as objectToString,
|
|
38
|
+
s as optionalRequire,
|
|
39
|
+
U as resolveDefault,
|
|
40
|
+
W as strictEqual,
|
|
41
|
+
B as toArrayable,
|
|
42
|
+
I as toJsonSerializable,
|
|
43
|
+
K as toJsonable,
|
|
44
|
+
L as toLower,
|
|
45
|
+
R as toUpper,
|
|
46
|
+
C as typeOf,
|
|
47
|
+
G as upperFirst
|
|
46
48
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamically require a module in a way that works in both Node.js and bundled environments.
|
|
3
|
+
* The module name is passed as a variable to prevent static analysis by bundlers.
|
|
4
|
+
*
|
|
5
|
+
* @param moduleName - The name of the module to require
|
|
6
|
+
* @param errorMessage - Custom error message if module is not found
|
|
7
|
+
* @returns The required module
|
|
8
|
+
* @throws Error with helpful message if the module is not installed
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Load an optional dependency at runtime
|
|
12
|
+
* const pluralize = optionalRequire<typeof import('pluralize')>(
|
|
13
|
+
* 'pluralize',
|
|
14
|
+
* 'The "pluralize" package is required. Please install it: npm install pluralize'
|
|
15
|
+
* );
|
|
16
|
+
*/
|
|
17
|
+
export declare function optionalRequire<T>(moduleName: string, errorMessage?: string): T;
|
|
18
|
+
//# sourceMappingURL=optional-require.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-require.d.ts","sourceRoot":"","sources":["../src/optional-require.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC7B,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACtB,CAAC,CAaH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinaid/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A set of utility functions for the @zinaid packages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"require": "./dist/index.js",
|
|
22
22
|
"types": "./dist/index.d.ts"
|
|
23
23
|
},
|
|
24
|
+
"./optional-require": {
|
|
25
|
+
"import": "./dist/optional-require.js",
|
|
26
|
+
"types": "./dist/optional-require.d.ts"
|
|
27
|
+
},
|
|
24
28
|
"./utils": {
|
|
25
29
|
"import": "./dist/utils.js",
|
|
26
30
|
"types": "./dist/utils.d.ts"
|