@slickgrid-universal/utils
Advanced tools
Comparing version 4.6.1 to 4.7.0
"use strict"; | ||
/* eslint-disable guard-for-in */ | ||
/** | ||
@@ -4,0 +3,0 @@ * This extend function is a reimplementation of the npm package `extend` (also named `node-extend`). |
@@ -21,3 +21,3 @@ "use strict"; | ||
const ALLOWED_TAGS_REGEX = /<(\w*)>/g; | ||
const NORMALIZE_TAG_REGEX = /<\/?([^\s\/>]+)/; | ||
const NORMALIZE_TAG_REGEX = /<\/?([^\s/>]+)/; | ||
function stripTags(htmlText, allowableTags, tagReplacement) { | ||
@@ -24,0 +24,0 @@ /** main init function that will be executed when calling the global function */ |
@@ -178,3 +178,3 @@ "use strict"; | ||
const getFunctionParams = (func) => { | ||
const STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,\)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,\)]*))/mg; | ||
const STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,)]*))/mg; | ||
const ARG_NAMES = /([^\s,]+)/g; | ||
@@ -243,5 +243,5 @@ const fnStr = func.toString().replace(STRIP_COMMENTS, ''); | ||
* Check if input value is a number, by default it won't be a strict checking | ||
* but optionally we could check for strict equality, for example in strict "3" will return False but without strict it will return True | ||
* but optionally we could check for strict equality, for example "3" in strict mode would return False but True when non-strict. | ||
* @param value - input value of any type | ||
* @param strict - when using strict it also check for strict equality, for example in strict "3" would return False but without strict it would return True | ||
* @param strict - when using strict it also check for strict equality, e.g "3" in strict mode would return False but True when non-strict | ||
*/ | ||
@@ -319,5 +319,5 @@ function isNumber(value, strict = false) { | ||
if (typeof inputStr === 'string') { | ||
return inputStr.replace(/(?:^\w|[A-Z]|\b\w|[\s+\-_\/])/g, (match, offset) => { | ||
return inputStr.replace(/(?:^\w|[A-Z]|\b\w|[\s+\-_/])/g, (match, offset) => { | ||
// remove white space or hypens or underscores | ||
if (/[\s+\-_\/]/.test(match)) { | ||
if (/[\s+\-_/]/.test(match)) { | ||
return ''; | ||
@@ -350,3 +350,3 @@ } | ||
if (typeof inputStr === 'string') { | ||
const result = inputStr.replace(/([A-Z])|(\-)/g, ' $1').replace(/\s+/g, ' ').trim(); | ||
const result = inputStr.replace(/([A-Z])|(-)/g, ' $1').replace(/\s+/g, ' ').trim(); | ||
return result.charAt(0).toUpperCase() + result.slice(1); | ||
@@ -353,0 +353,0 @@ } |
@@ -1,2 +0,1 @@ | ||
/* eslint-disable guard-for-in */ | ||
/** | ||
@@ -3,0 +2,0 @@ * This extend function is a reimplementation of the npm package `extend` (also named `node-extend`). |
@@ -18,3 +18,3 @@ /** | ||
const ALLOWED_TAGS_REGEX = /<(\w*)>/g; | ||
const NORMALIZE_TAG_REGEX = /<\/?([^\s\/>]+)/; | ||
const NORMALIZE_TAG_REGEX = /<\/?([^\s/>]+)/; | ||
export function stripTags(htmlText, allowableTags, tagReplacement) { | ||
@@ -21,0 +21,0 @@ /** main init function that will be executed when calling the global function */ |
@@ -169,3 +169,3 @@ /** | ||
const getFunctionParams = (func) => { | ||
const STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,\)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,\)]*))/mg; | ||
const STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,)]*))/mg; | ||
const ARG_NAMES = /([^\s,]+)/g; | ||
@@ -226,5 +226,5 @@ const fnStr = func.toString().replace(STRIP_COMMENTS, ''); | ||
* Check if input value is a number, by default it won't be a strict checking | ||
* but optionally we could check for strict equality, for example in strict "3" will return False but without strict it will return True | ||
* but optionally we could check for strict equality, for example "3" in strict mode would return False but True when non-strict. | ||
* @param value - input value of any type | ||
* @param strict - when using strict it also check for strict equality, for example in strict "3" would return False but without strict it would return True | ||
* @param strict - when using strict it also check for strict equality, e.g "3" in strict mode would return False but True when non-strict | ||
*/ | ||
@@ -296,5 +296,5 @@ export function isNumber(value, strict = false) { | ||
if (typeof inputStr === 'string') { | ||
return inputStr.replace(/(?:^\w|[A-Z]|\b\w|[\s+\-_\/])/g, (match, offset) => { | ||
return inputStr.replace(/(?:^\w|[A-Z]|\b\w|[\s+\-_/])/g, (match, offset) => { | ||
// remove white space or hypens or underscores | ||
if (/[\s+\-_\/]/.test(match)) { | ||
if (/[\s+\-_/]/.test(match)) { | ||
return ''; | ||
@@ -325,3 +325,3 @@ } | ||
if (typeof inputStr === 'string') { | ||
const result = inputStr.replace(/([A-Z])|(\-)/g, ' $1').replace(/\s+/g, ' ').trim(); | ||
const result = inputStr.replace(/([A-Z])|(-)/g, ' $1').replace(/\s+/g, ' ').trim(); | ||
return result.charAt(0).toUpperCase() + result.slice(1); | ||
@@ -328,0 +328,0 @@ } |
@@ -81,5 +81,5 @@ import type { AnyFunction } from './models/types'; | ||
* Check if input value is a number, by default it won't be a strict checking | ||
* but optionally we could check for strict equality, for example in strict "3" will return False but without strict it will return True | ||
* but optionally we could check for strict equality, for example "3" in strict mode would return False but True when non-strict. | ||
* @param value - input value of any type | ||
* @param strict - when using strict it also check for strict equality, for example in strict "3" would return False but without strict it would return True | ||
* @param strict - when using strict it also check for strict equality, e.g "3" in strict mode would return False but True when non-strict | ||
*/ | ||
@@ -86,0 +86,0 @@ export declare function isNumber(value: any, strict?: boolean): boolean; |
{ | ||
"name": "@slickgrid-universal/utils", | ||
"version": "4.6.1", | ||
"version": "4.7.0", | ||
"description": "Common set of small utilities", | ||
@@ -40,3 +40,3 @@ "main": "./dist/cjs/index.js", | ||
], | ||
"gitHead": "445c8be8926bbfff1782db1c9a2a6baa070d9239" | ||
"gitHead": "185b6f9e44400bec2f1d79568905ca79e4b338a5" | ||
} |
/* eslint-disable @typescript-eslint/indent */ | ||
export type InferDOMType<T> = | ||
T extends CSSStyleDeclaration ? Partial<CSSStyleDeclaration> : | ||
T extends infer R ? R : any; | ||
/* eslint-enable @typescript-eslint/indent */ | ||
export type AnyFunction = (...args: any[]) => any; |
@@ -1,2 +0,1 @@ | ||
/* eslint-disable guard-for-in */ | ||
/** | ||
@@ -3,0 +2,0 @@ * This extend function is a reimplementation of the npm package `extend` (also named `node-extend`). |
@@ -20,3 +20,3 @@ /** | ||
const ALLOWED_TAGS_REGEX = /<(\w*)>/g; | ||
const NORMALIZE_TAG_REGEX = /<\/?([^\s\/>]+)/; | ||
const NORMALIZE_TAG_REGEX = /<\/?([^\s/>]+)/; | ||
@@ -23,0 +23,0 @@ interface Context { |
@@ -187,3 +187,3 @@ import type { AnyFunction } from './models/types'; | ||
const getFunctionParams = (func: AnyFunction): string[] => { | ||
const STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,\)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,\)]*))/mg; | ||
const STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,)]*))/mg; | ||
const ARG_NAMES = /([^\s,]+)/g; | ||
@@ -253,5 +253,5 @@ const fnStr = func.toString().replace(STRIP_COMMENTS, ''); | ||
* Check if input value is a number, by default it won't be a strict checking | ||
* but optionally we could check for strict equality, for example in strict "3" will return False but without strict it will return True | ||
* but optionally we could check for strict equality, for example "3" in strict mode would return False but True when non-strict. | ||
* @param value - input value of any type | ||
* @param strict - when using strict it also check for strict equality, for example in strict "3" would return False but without strict it would return True | ||
* @param strict - when using strict it also check for strict equality, e.g "3" in strict mode would return False but True when non-strict | ||
*/ | ||
@@ -333,5 +333,5 @@ export function isNumber(value: any, strict = false) { | ||
if (typeof inputStr === 'string') { | ||
return inputStr.replace(/(?:^\w|[A-Z]|\b\w|[\s+\-_\/])/g, (match: string, offset: number) => { | ||
return inputStr.replace(/(?:^\w|[A-Z]|\b\w|[\s+\-_/])/g, (match: string, offset: number) => { | ||
// remove white space or hypens or underscores | ||
if (/[\s+\-_\/]/.test(match)) { | ||
if (/[\s+\-_/]/.test(match)) { | ||
return ''; | ||
@@ -365,3 +365,3 @@ } | ||
if (typeof inputStr === 'string') { | ||
const result = inputStr.replace(/([A-Z])|(\-)/g, ' $1').replace(/\s+/g, ' ').trim(); | ||
const result = inputStr.replace(/([A-Z])|(-)/g, ' $1').replace(/\s+/g, ' ').trim(); | ||
return result.charAt(0).toUpperCase() + result.slice(1); | ||
@@ -368,0 +368,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
222946
61
3169