@slickgrid-universal/utils
Advanced tools
Comparing version 1.4.0 to 2.0.0-alpha.0
@@ -53,2 +53,8 @@ /** | ||
/** | ||
* Simple check to detect if the value is a primitive type | ||
* @param val | ||
* @returns {boolean} | ||
*/ | ||
export declare function isPrimmitive(val: any): boolean; | ||
/** | ||
* Check if a value has any data (undefined, null or empty string will return False...) | ||
@@ -66,3 +72,3 @@ * NOTE: a `false` boolean is consider as having data so it will return True | ||
/** Check if an object is empty, it will also be considered empty when the input is null, undefined or isn't an object */ | ||
export declare function isObjectEmpty(obj: unknown): unknown; | ||
export declare function isObjectEmpty(obj: unknown): boolean; | ||
/** Parse any input (bool, number, string) and return a boolean or False when not possible */ | ||
@@ -69,0 +75,0 @@ export declare function parseBoolean(input: any): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uniqueObjectArray = exports.uniqueArray = exports.toSnakeCase = exports.toSentenceCase = exports.toKebabCase = exports.toCamelCase = exports.titleCase = exports.setDeepValue = exports.removeAccentFromText = exports.parseBoolean = exports.isObjectEmpty = exports.isNumber = exports.hasData = exports.isObject = exports.isEmptyObject = exports.emptyObject = exports.deepMerge = exports.deepCopy = exports.arrayRemoveItemByIndex = exports.addWhiteSpaces = exports.addToArrayWhenNotExists = void 0; | ||
exports.uniqueObjectArray = exports.uniqueArray = exports.toSnakeCase = exports.toSentenceCase = exports.toKebabCase = exports.toCamelCase = exports.titleCase = exports.setDeepValue = exports.removeAccentFromText = exports.parseBoolean = exports.isObjectEmpty = exports.isNumber = exports.hasData = exports.isPrimmitive = exports.isObject = exports.isEmptyObject = exports.emptyObject = exports.deepMerge = exports.deepCopy = exports.arrayRemoveItemByIndex = exports.addWhiteSpaces = exports.addToArrayWhenNotExists = void 0; | ||
/** | ||
@@ -12,3 +12,3 @@ * Add an item to an array only when the item does not exists, when the item is an object we will be using their "id" to compare | ||
let arrayRowIndex = -1; | ||
if (typeof inputItem === 'object' && itemIdPropName in inputItem) { | ||
if (inputItem && typeof inputItem === 'object' && itemIdPropName in inputItem) { | ||
arrayRowIndex = inputArray.findIndex((item) => item[itemIdPropName] === inputItem[itemIdPropName]); | ||
@@ -174,2 +174,11 @@ } | ||
/** | ||
* Simple check to detect if the value is a primitive type | ||
* @param val | ||
* @returns {boolean} | ||
*/ | ||
function isPrimmitive(val) { | ||
return val === null || val === undefined || typeof val === 'boolean' || typeof val === 'number' || typeof val === 'string'; | ||
} | ||
exports.isPrimmitive = isPrimmitive; | ||
/** | ||
* Check if a value has any data (undefined, null or empty string will return False...) | ||
@@ -176,0 +185,0 @@ * NOTE: a `false` boolean is consider as having data so it will return True |
@@ -53,2 +53,8 @@ /** | ||
/** | ||
* Simple check to detect if the value is a primitive type | ||
* @param val | ||
* @returns {boolean} | ||
*/ | ||
export declare function isPrimmitive(val: any): boolean; | ||
/** | ||
* Check if a value has any data (undefined, null or empty string will return False...) | ||
@@ -66,3 +72,3 @@ * NOTE: a `false` boolean is consider as having data so it will return True | ||
/** Check if an object is empty, it will also be considered empty when the input is null, undefined or isn't an object */ | ||
export declare function isObjectEmpty(obj: unknown): unknown; | ||
export declare function isObjectEmpty(obj: unknown): boolean; | ||
/** Parse any input (bool, number, string) and return a boolean or False when not possible */ | ||
@@ -69,0 +75,0 @@ export declare function parseBoolean(input: any): boolean; |
@@ -9,3 +9,3 @@ /** | ||
let arrayRowIndex = -1; | ||
if (typeof inputItem === 'object' && itemIdPropName in inputItem) { | ||
if (inputItem && typeof inputItem === 'object' && itemIdPropName in inputItem) { | ||
arrayRowIndex = inputArray.findIndex((item) => item[itemIdPropName] === inputItem[itemIdPropName]); | ||
@@ -163,2 +163,10 @@ } | ||
/** | ||
* Simple check to detect if the value is a primitive type | ||
* @param val | ||
* @returns {boolean} | ||
*/ | ||
export function isPrimmitive(val) { | ||
return val === null || val === undefined || typeof val === 'boolean' || typeof val === 'number' || typeof val === 'string'; | ||
} | ||
/** | ||
* Check if a value has any data (undefined, null or empty string will return False...) | ||
@@ -165,0 +173,0 @@ * NOTE: a `false` boolean is consider as having data so it will return True |
{ | ||
"name": "@slickgrid-universal/utils", | ||
"version": "1.4.0", | ||
"version": "2.0.0-alpha.0", | ||
"description": "Common set of small utilities", | ||
@@ -15,15 +15,2 @@ "main": "dist/commonjs/index.js", | ||
], | ||
"scripts": { | ||
"build": "pnpm run bundle:commonjs", | ||
"build:watch": "tsc --incremental --watch", | ||
"clean": "rimraf --maxBusyTries=10 packages/*/dist dist", | ||
"dev": "pnpm run bundle:commonjs", | ||
"dev:watch": "tsc --incremental --watch", | ||
"prebundle": "pnpm run clean", | ||
"bundle": "run-p bundle:commonjs bundle:esm --npm-path npm", | ||
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs", | ||
"bundle:esm": "tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018", | ||
"package:add-browser-prop": "cross-env node ../change-package-browser.js --add-browser=true --folder-name=utils", | ||
"package:remove-browser-prop": "cross-env node ../change-package-browser.js --remove-browser=true --folder-name=utils" | ||
}, | ||
"license": "MIT", | ||
@@ -45,9 +32,3 @@ "author": "Ghislain B.", | ||
], | ||
"devDependencies": { | ||
"@types/jquery": "^3.5.14", | ||
"cross-env": "^7.0.3", | ||
"npm-run-all2": "^6.0.1", | ||
"rimraf": "^3.0.2" | ||
}, | ||
"gitHead": "43cfa29f47287454ce0c4945a3c75575073013e1" | ||
} | ||
"gitHead": "d9eaebb23161f4a627cbfaaa403675a2ab20cdb1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
59630
0
954
1