@salespark/toolkit 2.1.3 → 2.1.5
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/README.md +9 -7
- package/dist/index.cjs +13 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -429,7 +429,14 @@ declare const hasNilOrEmpty: (array: unknown) => boolean;
|
|
|
429
429
|
* @param {unknown} value - Value to check
|
|
430
430
|
* History:
|
|
431
431
|
* 21-08-2025: Created
|
|
432
|
+
* 08-11-2025: Fixed type-safety and logic - added proper 'length' property check using 'in' operator,
|
|
433
|
+
* changed catch block to return false (don't assume error means empty), added explicit
|
|
434
|
+
* false return for values without length property
|
|
432
435
|
****************************************************/
|
|
436
|
+
declare const isNilEmptyOrZeroLength: (value: unknown) => boolean;
|
|
437
|
+
/**
|
|
438
|
+
* @deprecated Use `isNilEmptyOrZeroLength` instead.
|
|
439
|
+
*/
|
|
433
440
|
declare const isNilEmptyOrZeroLen: (value: unknown) => boolean;
|
|
434
441
|
/******************************************************
|
|
435
442
|
* ##: Nil or Zero Length Check
|
|
@@ -437,7 +444,14 @@ declare const isNilEmptyOrZeroLen: (value: unknown) => boolean;
|
|
|
437
444
|
* @param {unknown} value - Value to check
|
|
438
445
|
* History:
|
|
439
446
|
* 21-08-2025: Created
|
|
447
|
+
* 08-11-2025: Fixed type-safety and logic - added proper 'length' property check using 'in' operator,
|
|
448
|
+
* changed catch block to return false (don't assume error means empty), added explicit
|
|
449
|
+
* false return for values without length property
|
|
440
450
|
****************************************************/
|
|
451
|
+
declare const isNilOrZeroLength: (value: unknown) => boolean;
|
|
452
|
+
/**
|
|
453
|
+
* @deprecated Use `isNilOrZeroLength` instead.
|
|
454
|
+
*/
|
|
441
455
|
declare const isNilOrZeroLen: (value: unknown) => boolean;
|
|
442
456
|
/******************************************************
|
|
443
457
|
* ##: Nil or NaN Check
|
|
@@ -695,4 +709,4 @@ declare const assessSecurityRisks: (risks: SecurityRisk[]) => {
|
|
|
695
709
|
declare const isBrowser: boolean;
|
|
696
710
|
declare const isNode: boolean;
|
|
697
711
|
|
|
698
|
-
export { type SecurityCheckResult, type SecurityRisk, addSpaceBetweenNumbers, addThousandsSpace, areArraysDeepEqualUnordered, areArraysEqual, assessSecurityRisks, basicSanitize, checkMarkdownSecurity, chunk, clamp, cleanObject, compact, currencyToSymbol, debounce, deburr, delay, difference, fill, flatten, flattenDepth, flattenDepthBase, flattenOnce, formatBytes, formatCurrency, formatDecimalNumber, getStringSimilarity, groupBy, hasNilOrEmpty, humanFileSize, intersection, isBrowser, isFlattenable, isNil, isNilEmptyOrZeroLen, isNilOrEmpty, isNilOrNaN, isNilOrZeroLen, isNilText, isNilTextOrEmpty, isNode, isNullOrUndefined, isNullOrUndefinedEmptyOrZero, isNullOrUndefinedInArray, isNullOrUndefinedOrNaN, isNullOrUndefinedTextInc, isNullUndefinedOrEmpty, isNullUndefinedOrEmptyEnforced, isNullUndefinedOrZero, isPTTaxId, isValidIBAN, isValidPTTaxId, objectToString, omit, otp, parseName, parseToBool, parseToNumber, pick, pluck, pushAll, randomDigits, removeDiacritics, round, safeParseFloat, safeParseInt, sanitize, sanitizeMarkdown, shuffle, slugify, sortBy, stringSimilarity, symbolToCurrency, throttle, toBool, toInteger, toNumber, uniq, uniqBy };
|
|
712
|
+
export { type SecurityCheckResult, type SecurityRisk, addSpaceBetweenNumbers, addThousandsSpace, areArraysDeepEqualUnordered, areArraysEqual, assessSecurityRisks, basicSanitize, checkMarkdownSecurity, chunk, clamp, cleanObject, compact, currencyToSymbol, debounce, deburr, delay, difference, fill, flatten, flattenDepth, flattenDepthBase, flattenOnce, formatBytes, formatCurrency, formatDecimalNumber, getStringSimilarity, groupBy, hasNilOrEmpty, humanFileSize, intersection, isBrowser, isFlattenable, isNil, isNilEmptyOrZeroLen, isNilEmptyOrZeroLength, isNilOrEmpty, isNilOrNaN, isNilOrZeroLen, isNilOrZeroLength, isNilText, isNilTextOrEmpty, isNode, isNullOrUndefined, isNullOrUndefinedEmptyOrZero, isNullOrUndefinedInArray, isNullOrUndefinedOrNaN, isNullOrUndefinedTextInc, isNullUndefinedOrEmpty, isNullUndefinedOrEmptyEnforced, isNullUndefinedOrZero, isPTTaxId, isValidIBAN, isValidPTTaxId, objectToString, omit, otp, parseName, parseToBool, parseToNumber, pick, pluck, pushAll, randomDigits, removeDiacritics, round, safeParseFloat, safeParseInt, sanitize, sanitizeMarkdown, shuffle, slugify, sortBy, stringSimilarity, symbolToCurrency, throttle, toBool, toInteger, toNumber, uniq, uniqBy };
|
package/dist/index.d.ts
CHANGED
|
@@ -429,7 +429,14 @@ declare const hasNilOrEmpty: (array: unknown) => boolean;
|
|
|
429
429
|
* @param {unknown} value - Value to check
|
|
430
430
|
* History:
|
|
431
431
|
* 21-08-2025: Created
|
|
432
|
+
* 08-11-2025: Fixed type-safety and logic - added proper 'length' property check using 'in' operator,
|
|
433
|
+
* changed catch block to return false (don't assume error means empty), added explicit
|
|
434
|
+
* false return for values without length property
|
|
432
435
|
****************************************************/
|
|
436
|
+
declare const isNilEmptyOrZeroLength: (value: unknown) => boolean;
|
|
437
|
+
/**
|
|
438
|
+
* @deprecated Use `isNilEmptyOrZeroLength` instead.
|
|
439
|
+
*/
|
|
433
440
|
declare const isNilEmptyOrZeroLen: (value: unknown) => boolean;
|
|
434
441
|
/******************************************************
|
|
435
442
|
* ##: Nil or Zero Length Check
|
|
@@ -437,7 +444,14 @@ declare const isNilEmptyOrZeroLen: (value: unknown) => boolean;
|
|
|
437
444
|
* @param {unknown} value - Value to check
|
|
438
445
|
* History:
|
|
439
446
|
* 21-08-2025: Created
|
|
447
|
+
* 08-11-2025: Fixed type-safety and logic - added proper 'length' property check using 'in' operator,
|
|
448
|
+
* changed catch block to return false (don't assume error means empty), added explicit
|
|
449
|
+
* false return for values without length property
|
|
440
450
|
****************************************************/
|
|
451
|
+
declare const isNilOrZeroLength: (value: unknown) => boolean;
|
|
452
|
+
/**
|
|
453
|
+
* @deprecated Use `isNilOrZeroLength` instead.
|
|
454
|
+
*/
|
|
441
455
|
declare const isNilOrZeroLen: (value: unknown) => boolean;
|
|
442
456
|
/******************************************************
|
|
443
457
|
* ##: Nil or NaN Check
|
|
@@ -695,4 +709,4 @@ declare const assessSecurityRisks: (risks: SecurityRisk[]) => {
|
|
|
695
709
|
declare const isBrowser: boolean;
|
|
696
710
|
declare const isNode: boolean;
|
|
697
711
|
|
|
698
|
-
export { type SecurityCheckResult, type SecurityRisk, addSpaceBetweenNumbers, addThousandsSpace, areArraysDeepEqualUnordered, areArraysEqual, assessSecurityRisks, basicSanitize, checkMarkdownSecurity, chunk, clamp, cleanObject, compact, currencyToSymbol, debounce, deburr, delay, difference, fill, flatten, flattenDepth, flattenDepthBase, flattenOnce, formatBytes, formatCurrency, formatDecimalNumber, getStringSimilarity, groupBy, hasNilOrEmpty, humanFileSize, intersection, isBrowser, isFlattenable, isNil, isNilEmptyOrZeroLen, isNilOrEmpty, isNilOrNaN, isNilOrZeroLen, isNilText, isNilTextOrEmpty, isNode, isNullOrUndefined, isNullOrUndefinedEmptyOrZero, isNullOrUndefinedInArray, isNullOrUndefinedOrNaN, isNullOrUndefinedTextInc, isNullUndefinedOrEmpty, isNullUndefinedOrEmptyEnforced, isNullUndefinedOrZero, isPTTaxId, isValidIBAN, isValidPTTaxId, objectToString, omit, otp, parseName, parseToBool, parseToNumber, pick, pluck, pushAll, randomDigits, removeDiacritics, round, safeParseFloat, safeParseInt, sanitize, sanitizeMarkdown, shuffle, slugify, sortBy, stringSimilarity, symbolToCurrency, throttle, toBool, toInteger, toNumber, uniq, uniqBy };
|
|
712
|
+
export { type SecurityCheckResult, type SecurityRisk, addSpaceBetweenNumbers, addThousandsSpace, areArraysDeepEqualUnordered, areArraysEqual, assessSecurityRisks, basicSanitize, checkMarkdownSecurity, chunk, clamp, cleanObject, compact, currencyToSymbol, debounce, deburr, delay, difference, fill, flatten, flattenDepth, flattenDepthBase, flattenOnce, formatBytes, formatCurrency, formatDecimalNumber, getStringSimilarity, groupBy, hasNilOrEmpty, humanFileSize, intersection, isBrowser, isFlattenable, isNil, isNilEmptyOrZeroLen, isNilEmptyOrZeroLength, isNilOrEmpty, isNilOrNaN, isNilOrZeroLen, isNilOrZeroLength, isNilText, isNilTextOrEmpty, isNode, isNullOrUndefined, isNullOrUndefinedEmptyOrZero, isNullOrUndefinedInArray, isNullOrUndefinedOrNaN, isNullOrUndefinedTextInc, isNullUndefinedOrEmpty, isNullUndefinedOrEmptyEnforced, isNullUndefinedOrZero, isPTTaxId, isValidIBAN, isValidPTTaxId, objectToString, omit, otp, parseName, parseToBool, parseToNumber, pick, pluck, pushAll, randomDigits, removeDiacritics, round, safeParseFloat, safeParseInt, sanitize, sanitizeMarkdown, shuffle, slugify, sortBy, stringSimilarity, symbolToCurrency, throttle, toBool, toInteger, toNumber, uniq, uniqBy };
|
package/dist/index.js
CHANGED
|
@@ -387,24 +387,28 @@ var hasNilOrEmpty = (array) => {
|
|
|
387
387
|
return true;
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
|
-
var
|
|
390
|
+
var isNilEmptyOrZeroLength = (value) => {
|
|
391
391
|
try {
|
|
392
|
-
if (isNil(value)
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
if (isNil(value)) return true;
|
|
393
|
+
if (value === "") return true;
|
|
394
|
+
if (typeof value === "string" && value.length > 0) return false;
|
|
395
|
+
if (Array.isArray(value) && value.length > 0) return false;
|
|
396
|
+
return true;
|
|
395
397
|
} catch {
|
|
396
398
|
return true;
|
|
397
399
|
}
|
|
398
400
|
};
|
|
399
|
-
var
|
|
401
|
+
var isNilEmptyOrZeroLen = isNilEmptyOrZeroLength;
|
|
402
|
+
var isNilOrZeroLength = (value) => {
|
|
400
403
|
try {
|
|
401
404
|
if (isNil(value)) return true;
|
|
402
|
-
|
|
403
|
-
return
|
|
405
|
+
if (Array.isArray(value) && value.length > 0) return false;
|
|
406
|
+
return true;
|
|
404
407
|
} catch {
|
|
405
408
|
return true;
|
|
406
409
|
}
|
|
407
410
|
};
|
|
411
|
+
var isNilOrZeroLen = isNilOrZeroLength;
|
|
408
412
|
var isNilOrNaN = (value) => {
|
|
409
413
|
try {
|
|
410
414
|
return isNil(value) || isNaN(value);
|
|
@@ -1615,6 +1619,6 @@ var assessSecurityRisks = (risks) => {
|
|
|
1615
1619
|
var isBrowser = typeof globalThis !== "undefined" && typeof globalThis.document !== "undefined";
|
|
1616
1620
|
var isNode = typeof process !== "undefined" && !!process.versions?.node;
|
|
1617
1621
|
|
|
1618
|
-
export { addSpaceBetweenNumbers, addThousandsSpace, areArraysDeepEqualUnordered, areArraysEqual, assessSecurityRisks, basicSanitize, checkMarkdownSecurity, chunk, clamp, cleanObject, compact, currencyToSymbol, debounce, deburr, delay, difference, fill, flatten, flattenDepth, flattenDepthBase, flattenOnce, formatBytes, formatCurrency, formatDecimalNumber, getStringSimilarity, groupBy, hasNilOrEmpty, humanFileSize, intersection, isBrowser, isFlattenable, isNil, isNilEmptyOrZeroLen, isNilOrEmpty, isNilOrNaN, isNilOrZeroLen, isNilText, isNilTextOrEmpty, isNode, isNullOrUndefined, isNullOrUndefinedEmptyOrZero, isNullOrUndefinedInArray, isNullOrUndefinedOrNaN, isNullOrUndefinedTextInc, isNullUndefinedOrEmpty, isNullUndefinedOrEmptyEnforced, isNullUndefinedOrZero, isPTTaxId, isValidIBAN, isValidPTTaxId, objectToString, omit, otp, parseName, parseToBool, parseToNumber, pick, pluck, pushAll, randomDigits, removeDiacritics, round, safeParseFloat, safeParseInt, sanitize, sanitizeMarkdown, shuffle, slugify, sortBy, stringSimilarity, symbolToCurrency, throttle, toBool, toInteger, toNumber, uniq, uniqBy };
|
|
1622
|
+
export { addSpaceBetweenNumbers, addThousandsSpace, areArraysDeepEqualUnordered, areArraysEqual, assessSecurityRisks, basicSanitize, checkMarkdownSecurity, chunk, clamp, cleanObject, compact, currencyToSymbol, debounce, deburr, delay, difference, fill, flatten, flattenDepth, flattenDepthBase, flattenOnce, formatBytes, formatCurrency, formatDecimalNumber, getStringSimilarity, groupBy, hasNilOrEmpty, humanFileSize, intersection, isBrowser, isFlattenable, isNil, isNilEmptyOrZeroLen, isNilEmptyOrZeroLength, isNilOrEmpty, isNilOrNaN, isNilOrZeroLen, isNilOrZeroLength, isNilText, isNilTextOrEmpty, isNode, isNullOrUndefined, isNullOrUndefinedEmptyOrZero, isNullOrUndefinedInArray, isNullOrUndefinedOrNaN, isNullOrUndefinedTextInc, isNullUndefinedOrEmpty, isNullUndefinedOrEmptyEnforced, isNullUndefinedOrZero, isPTTaxId, isValidIBAN, isValidPTTaxId, objectToString, omit, otp, parseName, parseToBool, parseToNumber, pick, pluck, pushAll, randomDigits, removeDiacritics, round, safeParseFloat, safeParseInt, sanitize, sanitizeMarkdown, shuffle, slugify, sortBy, stringSimilarity, symbolToCurrency, throttle, toBool, toInteger, toNumber, uniq, uniqBy };
|
|
1619
1623
|
//# sourceMappingURL=index.js.map
|
|
1620
1624
|
//# sourceMappingURL=index.js.map
|