@ntnyq/utils 0.3.0 → 0.3.1
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 +5 -0
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +4 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(src_exports, {
|
|
|
46
46
|
isInteger: () => isInteger,
|
|
47
47
|
isNativePromise: () => isNativePromise,
|
|
48
48
|
isNil: () => isNil,
|
|
49
|
+
isNonEmptyString: () => isNonEmptyString,
|
|
49
50
|
isNull: () => isNull,
|
|
50
51
|
isNumber: () => isNumber,
|
|
51
52
|
isNumbericString: () => isNumbericString,
|
|
@@ -101,6 +102,9 @@ function isNumber(value) {
|
|
|
101
102
|
function isEmptyString(value) {
|
|
102
103
|
return isString(value) && value.length === 0;
|
|
103
104
|
}
|
|
105
|
+
function isNonEmptyString(value) {
|
|
106
|
+
return isString(value) && value.length > 0;
|
|
107
|
+
}
|
|
104
108
|
function isWhitespaceString(value) {
|
|
105
109
|
return isString(value) && /^\s*$/.test(value);
|
|
106
110
|
}
|
|
@@ -546,6 +550,7 @@ function sortObject(obj, options = {}) {
|
|
|
546
550
|
isInteger,
|
|
547
551
|
isNativePromise,
|
|
548
552
|
isNil,
|
|
553
|
+
isNonEmptyString,
|
|
549
554
|
isNull,
|
|
550
555
|
isNumber,
|
|
551
556
|
isNumbericString,
|
package/dist/index.d.cts
CHANGED
|
@@ -6,14 +6,15 @@ export * from 'scule';
|
|
|
6
6
|
* @category is
|
|
7
7
|
* @copyright {@link https://github.com/sindresorhus/is}
|
|
8
8
|
*/
|
|
9
|
-
declare function getObjectType(value: unknown): string;
|
|
10
|
-
declare function isString(value: unknown): value is string;
|
|
11
|
-
declare function isNumber(value: unknown): value is number;
|
|
12
|
-
declare function isEmptyString(value: unknown): value is '';
|
|
13
9
|
type Whitespace = ' ';
|
|
14
10
|
type NonEmptyString = string & {
|
|
15
11
|
0: '';
|
|
16
12
|
};
|
|
13
|
+
declare function getObjectType(value: unknown): string;
|
|
14
|
+
declare function isString(value: unknown): value is string;
|
|
15
|
+
declare function isNumber(value: unknown): value is number;
|
|
16
|
+
declare function isEmptyString(value: unknown): value is '';
|
|
17
|
+
declare function isNonEmptyString(value: unknown): value is NonEmptyString;
|
|
17
18
|
declare function isWhitespaceString(value: unknown): value is Whitespace;
|
|
18
19
|
declare function isEmptyStringOrWhitespace(value: unknown): value is '' | Whitespace;
|
|
19
20
|
declare function isNumbericString(value: unknown): value is `${number}`;
|
|
@@ -267,4 +268,4 @@ interface SortObjectOptions {
|
|
|
267
268
|
*/
|
|
268
269
|
declare function sortObject<T extends Record<string, any>>(obj: T, options?: SortObjectOptions): T;
|
|
269
270
|
|
|
270
|
-
export { type AnyFn, type Arrayable, type Awaitable, type MayBe, NOOP, type NonEmptyString, type Nullable, type Prettify, type PrettifyV2, type PrimitiveType, type SortObjectOptions, type ThrottleDebounceOptions, type Whitespace, at, cAF, capitalize, chunk, clamp, days, debounce, ensurePrefix, ensureSuffix, flattenArrayable, getObjectType, hasOwn, hours, isArray, isArrayEqual, isBoolean, isBrowser, isEmptyString, isEmptyStringOrWhitespace, isFunction, isInteger, isNativePromise, isNil, isNull, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isUndefined, isWhitespaceString, join, last, mergeArrayable, minutes, noop, omit, once, pick, rAF, seconds, slash, sortObject, throttle, toArray, unindent, unique, uniqueBy, waitFor, warnOnce, weeks };
|
|
271
|
+
export { type AnyFn, type Arrayable, type Awaitable, type MayBe, NOOP, type NonEmptyString, type Nullable, type Prettify, type PrettifyV2, type PrimitiveType, type SortObjectOptions, type ThrottleDebounceOptions, type Whitespace, at, cAF, capitalize, chunk, clamp, days, debounce, ensurePrefix, ensureSuffix, flattenArrayable, getObjectType, hasOwn, hours, isArray, isArrayEqual, isBoolean, isBrowser, isEmptyString, isEmptyStringOrWhitespace, isFunction, isInteger, isNativePromise, isNil, isNonEmptyString, isNull, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isUndefined, isWhitespaceString, join, last, mergeArrayable, minutes, noop, omit, once, pick, rAF, seconds, slash, sortObject, throttle, toArray, unindent, unique, uniqueBy, waitFor, warnOnce, weeks };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,15 @@ export * from 'scule';
|
|
|
6
6
|
* @category is
|
|
7
7
|
* @copyright {@link https://github.com/sindresorhus/is}
|
|
8
8
|
*/
|
|
9
|
-
declare function getObjectType(value: unknown): string;
|
|
10
|
-
declare function isString(value: unknown): value is string;
|
|
11
|
-
declare function isNumber(value: unknown): value is number;
|
|
12
|
-
declare function isEmptyString(value: unknown): value is '';
|
|
13
9
|
type Whitespace = ' ';
|
|
14
10
|
type NonEmptyString = string & {
|
|
15
11
|
0: '';
|
|
16
12
|
};
|
|
13
|
+
declare function getObjectType(value: unknown): string;
|
|
14
|
+
declare function isString(value: unknown): value is string;
|
|
15
|
+
declare function isNumber(value: unknown): value is number;
|
|
16
|
+
declare function isEmptyString(value: unknown): value is '';
|
|
17
|
+
declare function isNonEmptyString(value: unknown): value is NonEmptyString;
|
|
17
18
|
declare function isWhitespaceString(value: unknown): value is Whitespace;
|
|
18
19
|
declare function isEmptyStringOrWhitespace(value: unknown): value is '' | Whitespace;
|
|
19
20
|
declare function isNumbericString(value: unknown): value is `${number}`;
|
|
@@ -267,4 +268,4 @@ interface SortObjectOptions {
|
|
|
267
268
|
*/
|
|
268
269
|
declare function sortObject<T extends Record<string, any>>(obj: T, options?: SortObjectOptions): T;
|
|
269
270
|
|
|
270
|
-
export { type AnyFn, type Arrayable, type Awaitable, type MayBe, NOOP, type NonEmptyString, type Nullable, type Prettify, type PrettifyV2, type PrimitiveType, type SortObjectOptions, type ThrottleDebounceOptions, type Whitespace, at, cAF, capitalize, chunk, clamp, days, debounce, ensurePrefix, ensureSuffix, flattenArrayable, getObjectType, hasOwn, hours, isArray, isArrayEqual, isBoolean, isBrowser, isEmptyString, isEmptyStringOrWhitespace, isFunction, isInteger, isNativePromise, isNil, isNull, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isUndefined, isWhitespaceString, join, last, mergeArrayable, minutes, noop, omit, once, pick, rAF, seconds, slash, sortObject, throttle, toArray, unindent, unique, uniqueBy, waitFor, warnOnce, weeks };
|
|
271
|
+
export { type AnyFn, type Arrayable, type Awaitable, type MayBe, NOOP, type NonEmptyString, type Nullable, type Prettify, type PrettifyV2, type PrimitiveType, type SortObjectOptions, type ThrottleDebounceOptions, type Whitespace, at, cAF, capitalize, chunk, clamp, days, debounce, ensurePrefix, ensureSuffix, flattenArrayable, getObjectType, hasOwn, hours, isArray, isArrayEqual, isBoolean, isBrowser, isEmptyString, isEmptyStringOrWhitespace, isFunction, isInteger, isNativePromise, isNil, isNonEmptyString, isNull, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isUndefined, isWhitespaceString, join, last, mergeArrayable, minutes, noop, omit, once, pick, rAF, seconds, slash, sortObject, throttle, toArray, unindent, unique, uniqueBy, waitFor, warnOnce, weeks };
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,9 @@ function isNumber(value) {
|
|
|
11
11
|
function isEmptyString(value) {
|
|
12
12
|
return isString(value) && value.length === 0;
|
|
13
13
|
}
|
|
14
|
+
function isNonEmptyString(value) {
|
|
15
|
+
return isString(value) && value.length > 0;
|
|
16
|
+
}
|
|
14
17
|
function isWhitespaceString(value) {
|
|
15
18
|
return isString(value) && /^\s*$/.test(value);
|
|
16
19
|
}
|
|
@@ -455,6 +458,7 @@ export {
|
|
|
455
458
|
isInteger,
|
|
456
459
|
isNativePromise,
|
|
457
460
|
isNil,
|
|
461
|
+
isNonEmptyString,
|
|
458
462
|
isNull,
|
|
459
463
|
isNumber,
|
|
460
464
|
isNumbericString,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"description": "Common used utils.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"utils"
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@ntnyq/prettier-config": "^1.21.3",
|
|
45
45
|
"@vitest/coverage-v8": "^2.1.5",
|
|
46
46
|
"bumpp": "^9.8.1",
|
|
47
|
-
"eslint": "^9.
|
|
48
|
-
"husky": "^9.1.
|
|
47
|
+
"eslint": "^9.15.0",
|
|
48
|
+
"husky": "^9.1.7",
|
|
49
49
|
"nano-staged": "^0.8.0",
|
|
50
50
|
"npm-run-all2": "^7.0.1",
|
|
51
51
|
"prettier": "^3.3.3",
|