@aiszlab/relax 1.3.6 → 1.3.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/is/is-number.js +5 -0
- package/dist/is/is-string.js +5 -0
- package/dist/utils/clsx.d.ts +3 -0
- package/dist/utils/clsx.js +32 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import { isArray } from '../is/is-array.js';
|
|
3
|
+
import { isNumber } from '../is/is-number.js';
|
|
4
|
+
import { isString } from '../is/is-string.js';
|
|
5
|
+
import { isVoid } from '../is/is-void.js';
|
|
6
|
+
|
|
7
|
+
var _toClassNames = function toClassNames(value) {
|
|
8
|
+
if (isVoid(value)) return [];
|
|
9
|
+
if (isString(value) || isNumber(value)) return [value.toString()];
|
|
10
|
+
if (isArray(value)) {
|
|
11
|
+
return value.reduce(function (classNames, item) {
|
|
12
|
+
return classNames.concat(_toClassNames(item));
|
|
13
|
+
}, []);
|
|
14
|
+
}
|
|
15
|
+
return Object.entries(value).reduce(function (classNames, _ref) {
|
|
16
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
17
|
+
className = _ref2[0],
|
|
18
|
+
isValid = _ref2[1];
|
|
19
|
+
if (isValid) {
|
|
20
|
+
classNames.push(className);
|
|
21
|
+
}
|
|
22
|
+
return classNames;
|
|
23
|
+
}, []);
|
|
24
|
+
};
|
|
25
|
+
var clsx = function clsx() {
|
|
26
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
+
args[_key] = arguments[_key];
|
|
28
|
+
}
|
|
29
|
+
return _toClassNames(args).join(" ");
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { clsx };
|