@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 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;
@@ -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
@@ -0,0 +1,11 @@
1
+ function toArray(item) {
2
+ const array = item ?? [];
3
+ return Array.isArray(array) ? array : [array];
4
+ }
5
+ function toPixel(value) {
6
+ if (typeof value === 'string')
7
+ return value;
8
+ return `${value}px`;
9
+ }
10
+
11
+ export { toArray, toPixel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "TypeScript utils",
5
5
  "license": "MIT",
6
6
  "type": "module",