cafe-utility 11.0.0 → 11.0.2
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/index.d.ts +6 -6
- package/index.js +8 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ declare function asMegabytes(number: number): number;
|
|
|
42
42
|
declare function convertBytes(bytes: number): string;
|
|
43
43
|
declare function hexToRgb(hex: string): [number, number, number];
|
|
44
44
|
declare function rgbToHex(rgb: [number, number, number]): string;
|
|
45
|
-
declare function isObject(value: any): value is object;
|
|
45
|
+
declare function isObject(value: any, checkForPlainObject?: boolean): value is object;
|
|
46
46
|
declare function isStrictlyObject(value: any): value is object;
|
|
47
47
|
declare function isEmptyArray(value: any): boolean;
|
|
48
48
|
declare function isEmptyObject(value: any): boolean;
|
|
@@ -352,11 +352,11 @@ declare function tickPlaybook<T>(playbook: Playbook<T>): {
|
|
|
352
352
|
progress: number;
|
|
353
353
|
data: T;
|
|
354
354
|
} | null;
|
|
355
|
-
declare function getArgument(args: string[], key: string, env?: Record<string, string>, envKey?: string): string | null;
|
|
356
|
-
declare function getNumberArgument(args: string[], key: string, env?: Record<string, string>, envKey?: string): number | null;
|
|
357
|
-
declare function getBooleanArgument(args: string[], key: string, env?: Record<string, string>, envKey?: string): boolean | null;
|
|
358
|
-
declare function requireStringArgument(args: string[], key: string, env?: Record<string, string>, envKey?: string): string;
|
|
359
|
-
declare function requireNumberArgument(args: string[], key: string, env?: Record<string, string>, envKey?: string): number;
|
|
355
|
+
declare function getArgument(args: string[], key: string, env?: Record<string, string | undefined>, envKey?: string): string | null;
|
|
356
|
+
declare function getNumberArgument(args: string[], key: string, env?: Record<string, string | undefined>, envKey?: string): number | null;
|
|
357
|
+
declare function getBooleanArgument(args: string[], key: string, env?: Record<string, string | undefined>, envKey?: string): boolean | null;
|
|
358
|
+
declare function requireStringArgument(args: string[], key: string, env?: Record<string, string | undefined>, envKey?: string): string;
|
|
359
|
+
declare function requireNumberArgument(args: string[], key: string, env?: Record<string, string | undefined>, envKey?: string): number;
|
|
360
360
|
declare function bringToFrontInPlace<T>(array: T[], index: number): void;
|
|
361
361
|
declare function bringToFront<T>(array: T[], index: number): T[];
|
|
362
362
|
declare type Point = {
|
package/index.js
CHANGED
|
@@ -344,14 +344,18 @@ function rgbToHex(rgb) {
|
|
|
344
344
|
return '#' + rgb.map(x => x.toString(16).padStart(2, '0')).join('')
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
function isObject(value) {
|
|
347
|
+
function isObject(value, checkForPlainObject = true) {
|
|
348
348
|
if (!value) {
|
|
349
349
|
return false
|
|
350
350
|
}
|
|
351
|
-
if (value._readableState) {
|
|
351
|
+
if (checkForPlainObject && !isUndefined(value._readableState)) {
|
|
352
352
|
return false
|
|
353
353
|
}
|
|
354
|
-
if (
|
|
354
|
+
if (
|
|
355
|
+
checkForPlainObject &&
|
|
356
|
+
value.constructor &&
|
|
357
|
+
(value.constructor.isBuffer || value.constructor.name == 'Uint8Array')
|
|
358
|
+
) {
|
|
355
359
|
return false
|
|
356
360
|
}
|
|
357
361
|
return typeof value === 'object'
|
|
@@ -544,7 +548,7 @@ function asObject(value) {
|
|
|
544
548
|
}
|
|
545
549
|
|
|
546
550
|
function represent(value, strategy = 'json', depth = 0) {
|
|
547
|
-
if (isObject(value)) {
|
|
551
|
+
if (isObject(value, false)) {
|
|
548
552
|
if (depth > 1) {
|
|
549
553
|
return '[object Object]'
|
|
550
554
|
}
|