@tb-dev/utils 1.0.1 → 1.0.3
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.cjs +16 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +11 -0
- package/package.json +1 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
function toArray(item) {
|
|
6
|
+
const array = item ?? [];
|
|
7
|
+
return Array.isArray(array) ? array : [array];
|
|
8
|
+
}
|
|
9
|
+
function toPixel(value) {
|
|
10
|
+
if (typeof value === 'string')
|
|
11
|
+
return value;
|
|
12
|
+
return `${value}px`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.toArray = toArray;
|
|
16
|
+
exports.toPixel = toPixel;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MaybeArray } from '@tb-dev/utility-types';
|
|
2
|
+
import type { Nullish } from '@tb-dev/utility-types';
|
|
3
|
+
|
|
4
|
+
export declare function toArray<T>(item?: Nullish<MaybeArray<T>>): T[];
|
|
5
|
+
|
|
6
|
+
export declare function toPixel(value: string | number): string;
|
|
7
|
+
|
|
8
|
+
export { }
|
package/dist/index.mjs
ADDED