Comparing version 1.0.13 to 1.0.14
{ | ||
"name": "js-awe", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"homepage": "https://github.com/josuamanuel/js-awe", | ||
@@ -5,0 +5,0 @@ "author": "josuamanuel@hotmail.com", |
@@ -38,3 +38,3 @@ 'use strict' | ||
static of=CustomError | ||
static of = CustomError | ||
} | ||
@@ -249,4 +249,3 @@ // try { | ||
function transition(states, events, transitions) | ||
{ | ||
function transition(states, events, transitions) { | ||
states.forEach(validateStateFormat) | ||
@@ -262,4 +261,3 @@ events.forEach(validateEventFormat) | ||
let newStateValue = stateValue | ||
if(typeof stateValue === 'string') | ||
{ | ||
if (typeof stateValue === 'string') { | ||
validateState(stateValue) | ||
@@ -274,5 +272,4 @@ | ||
) | ||
}else | ||
{ | ||
Object.entries(newStateValue).forEach(([key, value])=> { | ||
} else { | ||
Object.entries(newStateValue).forEach(([key, value]) => { | ||
validateEvent(key) | ||
@@ -283,5 +280,5 @@ validateState(value) | ||
acum[stateKey] = {...acum[stateKey], ...newStateValue} | ||
acum[stateKey] = { ...acum[stateKey], ...newStateValue } | ||
return acum | ||
@@ -291,3 +288,3 @@ }, | ||
(acum, current) => { | ||
acum[current] = | ||
acum[current] = | ||
events.reduce( | ||
@@ -315,11 +312,9 @@ (acum2, el2) => { | ||
function validateStateFormat(state) | ||
{ | ||
if(state !== state.toUpperCase()) | ||
function validateStateFormat(state) { | ||
if (state !== state.toUpperCase()) | ||
throw new CustomError('STATE_MUST_BE_UPPERCASE', `The state: ${state} does not have all characters in uppercase`) | ||
} | ||
function validateState(state) | ||
{ | ||
if(states.some(el => el === state) === false) | ||
function validateState(state) { | ||
if (states.some(el => el === state) === false) | ||
throw new CustomError('STATE_NOT_FOUND', `The state: ${state} was not found in the list of states supplied: ${states}`) | ||
@@ -329,5 +324,4 @@ } | ||
function validateEventFormat(event) | ||
{ | ||
if(event !== event.toLowerCase()) | ||
function validateEventFormat(event) { | ||
if (event !== event.toLowerCase()) | ||
throw new CustomError('EVENT_MUST_BE_LOWERCASE', `The event: ${event} does not have all characters in lowercase`) | ||
@@ -337,5 +331,4 @@ } | ||
function validateEvent(event) | ||
{ | ||
if(events.some(el => el === event) === false) | ||
function validateEvent(event) { | ||
if (events.some(el => el === event) === false) | ||
throw new CustomError('EVENT_NOT_FOUND', `The event: ${event} was not found in the list of events supplied: ${events}`) | ||
@@ -499,21 +492,29 @@ } | ||
traverse.matchPath = function (pathStringQuery, reviverPath) { | ||
function traverseVertically(functionToRun, verFields, toTraverse) | ||
{ | ||
if(Array.isArray(toTraverse) === false) return | ||
let pathStringArr = pathStringQuery.split('.') | ||
if (pathStringArr.length !== reviverPath.length) { | ||
return false; | ||
} | ||
return pathStringArr.every( | ||
(el, index) => el === '*' || el === reviverPath[index] | ||
) | ||
} | ||
function traverseVertically(functionToRun, verFields, toTraverse) { | ||
if (Array.isArray(toTraverse) === false) return | ||
let runIndex = 0 | ||
let maxLength = 0 | ||
let firstTime = true | ||
for(let i = 0; firstTime || i < maxLength; i++) | ||
{ | ||
for (let i = 0; firstTime || i < maxLength; i++) { | ||
let toReturn = [] | ||
for(let j = 0; j< toTraverse.length; j++) | ||
{ | ||
toReturn[j] = {...toTraverse[j]} | ||
for(const field of verFields) | ||
{ | ||
if( firstTime) { | ||
for (let j = 0; j < toTraverse.length; j++) { | ||
toReturn[j] = { ...toTraverse[j] } | ||
for (const field of verFields) { | ||
if (firstTime) { | ||
maxLength = toTraverse[j]?.[field]?.length > maxLength | ||
? toTraverse[j][field].length | ||
? toTraverse[j][field].length | ||
: maxLength | ||
@@ -524,3 +525,3 @@ } | ||
} | ||
if(maxLength !== 0) { | ||
if (maxLength !== 0) { | ||
functionToRun(toReturn, runIndex) | ||
@@ -547,11 +548,11 @@ runIndex++ | ||
let valueToCopy = getValueAtPath(inputObj, from) | ||
let valueToCopy = getAt(inputObj, from) | ||
if (valueToCopy === undefined || valueToCopy === null) return | ||
if (shouldUpdateOnlyEmptyFields === true && isEmpty(getValueAtPath(objDest, to))) | ||
setValueAtPath(objDest, to, valueToCopy) | ||
if (shouldUpdateOnlyEmptyFields === true && isEmpty(getAt(objDest, to))) | ||
setAt(objDest, to, valueToCopy) | ||
if (shouldUpdateOnlyEmptyFields === false) | ||
setValueAtPath(objDest, to, valueToCopy) | ||
setAt(objDest, to, valueToCopy) | ||
@@ -595,4 +596,4 @@ } | ||
if (shouldUpdateOnlyEmptyFields === true) { | ||
const valueAtDest = getValueAtPath(objDest, destPath) | ||
if (isEmpty(valueAtDest)) setValueAtPath(objDest, destPath, nodeValue) | ||
const valueAtDest = getAt(objDest, destPath) | ||
if (isEmpty(valueAtDest)) setAt(objDest, destPath, nodeValue) | ||
@@ -602,3 +603,3 @@ return | ||
setValueAtPath(objDest, destPath, nodeValue) //? | ||
setAt(objDest, destPath, nodeValue) //? | ||
@@ -906,2 +907,15 @@ }) | ||
function addDays(daysToAdd, date) { | ||
let dateToReturn = | ||
date | ||
? new Date(date) | ||
: new Date() | ||
if (isDate(dateToReturn) === false) return date | ||
dateToReturn.setDate(dateToReturn.getDate() + daysToAdd); | ||
return dateToReturn | ||
} | ||
// addDays(2, "2022-01-01") //? | ||
function previousDayOfWeek(dayOfWeek, date) { | ||
@@ -920,4 +934,4 @@ let dateObj = date ?? new Date() | ||
} | ||
//previousDayOfWeek(6,new Date('2021-05-07')).toISOString() //? | ||
//previousDayOfWeek(1,new Date('2021-03-25')) | ||
//previousDayOfWeek(6,new Date('2021-05-07')) //? | ||
//previousDayOfWeek(1,new Date('2021-03-25')) //? | ||
@@ -1059,3 +1073,3 @@ function getSameDateOrPreviousFridayForWeekends(date) { | ||
function getValueAtPath(obj, valuePath) { | ||
function getAt(obj, valuePath) { | ||
if (obj === undefined || obj === null || valuePath === undefined || valuePath === null) { | ||
@@ -1086,10 +1100,12 @@ return | ||
} | ||
// getValueAtPath(undefined, '') //? | ||
// getValueAtPath(5, '') //? | ||
// getValueAtPath({arr:[1,2,{b:3}],j:{n:3}}, 'j') //? | ||
// getValueAtPath({arr:[1,2,{b:3}],j:{n:3}}, 'arr.$last.b') //? | ||
// getValueAtPath({arr:[1,2,{b:3}],j:{n:3}}, 'j') //? | ||
function setValueAtPath(obj, valuePath, value) { | ||
// getAt(undefined, '') //? | ||
// getAt(5, '') //? | ||
// getAt({arr:[1,2,{b:3}],j:{n:3}}, 'j') //? | ||
// getAt({arr:[1,2,{b:3}],j:{n:3}}, 'arr.$last.b') //? | ||
// getAt({arr:[1,2,{b:3}],j:{n:3}}, 'j') //? | ||
function setAt(obj, valuePath, value) { | ||
// modified the value of an existing property: {a:8} ==> 'a' with 12 => {a:12} | ||
@@ -1113,3 +1129,3 @@ const MODIFIED = 'MODIFIED' | ||
if (obj === undefined || obj === null || valuePath === undefined || valuePath === null) { | ||
throw { name: 'setValueAtPathParamsException', msg: 'obj: ' + obj + ', valuePath: ' + valuePath + ', value: ' + value } | ||
throw { name: 'setAtParamsException', msg: 'obj: ' + obj + ', valuePath: ' + valuePath + ', value: ' + value } | ||
} | ||
@@ -1119,9 +1135,8 @@ | ||
valuePathArray = typeof valuePath === 'string' ? valuePath.split('.') : valuePath | ||
valuePathArray | ||
for (let i = 0, j = valuePathArray.length; i < j; i++) { | ||
let field = nameToIndex(result, valuePathArray[i]) | ||
if (i === (valuePathArray.length - 1)) { | ||
if (result?.[valuePathArray[i]] !== undefined) { | ||
result?.[valuePathArray[i]] //? | ||
valueReturn | ||
if (valueReturn !== CREATED) valueReturn = MODIFIED | ||
@@ -1131,7 +1146,8 @@ } else { | ||
} | ||
result[valuePathArray[i]] = value | ||
result[field] = value | ||
} else { | ||
if (typeof result[valuePathArray[i]] !== 'object') { | ||
if (Number.isNaN(Number(valuePathArray[i + 1]))) result[valuePathArray[i]] = {} | ||
else result[valuePathArray[i]] = [] | ||
if (typeof result[field] !== 'object') { | ||
if (Number.isNaN(Number(valuePathArray[i + 1]))) result[field] = {} | ||
else result[field] = [] | ||
@@ -1141,11 +1157,11 @@ valueReturn = CREATED | ||
result = result[valuePathArray[i]] | ||
result = result[field] | ||
} | ||
} | ||
if (valueReturn === FAILED) { | ||
throw { name: 'setValueAtPathException', msg: 'obj: ' + obj + ', valuePath: ' + valuePath + ', value: ' + value } | ||
throw { name: 'setAtException', msg: 'obj: ' + obj + ', valuePath: ' + valuePath + ', value: ' + value } | ||
} | ||
} | ||
catch (e) { | ||
console.log(e + ' Warning: There was an exception in setValueAtPath(obj, valuePath, value)... obj: ' + obj + ' valuePath: ' + valuePath + ' value: ' + value) | ||
console.log(e + ' Warning: There was an exception in setAt(obj, valuePath, value)... obj: ' + obj + ' valuePath: ' + valuePath + ' value: ' + value) | ||
valueReturn = FAILED | ||
@@ -1155,17 +1171,52 @@ return valueReturn | ||
return valueReturn | ||
function nameToIndex(obj, field) | ||
{ | ||
if (Array.isArray(obj) && field === '$last') { | ||
return obj.length - 1 | ||
} | ||
if (Array.isArray(obj) && field === '$push') { | ||
return obj.length | ||
} | ||
if (Array.isArray(obj) && parseInt(field) < 0) { | ||
return obj.length + parseInt(valuePathArray[i]) | ||
} | ||
return field | ||
} | ||
} | ||
// { | ||
// let obj = {} | ||
// setValueAtPath(obj, 'a', '8') //? | ||
// obj //? | ||
// let obj2 = {a:3} | ||
// setValueAtPath(obj2, 'b', '8') //? | ||
// setValueAtPath(obj2, 'a.b', '8') //? | ||
// setValueAtPath(obj2, 'd.e', 'a') //? | ||
// obj2 | ||
// setValueAtPath(obj2, 'd.f', 'b') //? | ||
// setValueAtPath(obj2, 'd.e', 'aa') //? | ||
// setValueAtPath(obj2, 'e.g', 'c') //? | ||
// obj2 //? | ||
// } | ||
{ | ||
// let obj = {} | ||
// setAt(obj, 'a', '8') //? | ||
// obj //? | ||
// let obj2 = {a:3,b:{c:1}} | ||
// setAt(obj2, 'b', '8') //? | ||
// setAt(obj2, 'a.b', '8') //? | ||
// setAt(obj2, 'd.e', 'a') //? | ||
// obj2 //? | ||
// setAt(obj2, 'd.f', 'b') //? | ||
// setAt(obj2, 'd.e', 'aa') //? | ||
// setAt(obj2, 'e.g', 'c') //? | ||
// setAt(obj2, 'a.b.0.0.c', 'c') //? | ||
// obj2 //? | ||
// let obj3 = [1,2,3,4,5] | ||
// setAt(obj3,'-2',8) //? | ||
// obj3 //? | ||
// let obj4 = [1,2,3,4,5] | ||
// setAt(obj4,'$last',8) //? | ||
// obj4 //? | ||
// let obj5 = [1,2,3,4,5] | ||
// setAt(obj5,'$push',8) //? | ||
// obj5 //? | ||
// let obj6 = { | ||
// items: [ | ||
// {}, | ||
// { ar: [1, 2] } | ||
// ] | ||
// } | ||
// setAt(obj6,'items.$last.ar.$push',8) //? | ||
// obj6 //? | ||
} | ||
@@ -1188,4 +1239,4 @@ const sorterByPaths = (paths, isAsc = true) => { | ||
for (let currentPath of pathArr) { | ||
if (getValueAtPath(objA, currentPath) > getValueAtPath(objB, currentPath)) return great | ||
else if (getValueAtPath(objA, currentPath) < getValueAtPath(objB, currentPath)) return less | ||
if (getAt(objA, currentPath) > getAt(objB, currentPath)) return great | ||
else if (getAt(objA, currentPath) < getAt(objB, currentPath)) return less | ||
} | ||
@@ -1422,4 +1473,4 @@ | ||
function pushAt(pos,value, arr){ | ||
if(Array.isArray(arr) === false) throw new CustomError('PUSHAT_LAST_PARAMETER_MUST_BE_ARRAY') | ||
function pushAt(pos, value, arr) { | ||
if (Array.isArray(arr) === false) throw new CustomError('PUSHAT_LAST_PARAMETER_MUST_BE_ARRAY') | ||
@@ -1432,4 +1483,4 @@ // if(pos >= arr.length) { | ||
const length = arr.length | ||
repeat(arr.length - pos).times( index => arr[length - index] = arr[length - index - 1] ) | ||
arr[pos] = value | ||
repeat(arr.length - pos).times(index => arr[length - index] = arr[length - index - 1]) | ||
arr[pos] = value | ||
return arr | ||
@@ -1619,4 +1670,3 @@ | ||
process.exit(1) | ||
}catch(e) | ||
{ | ||
} catch (e) { | ||
console.log(e) | ||
@@ -1641,4 +1691,4 @@ } | ||
deepFreeze, | ||
getValueAtPath, | ||
setValueAtPath, | ||
getAt, | ||
setAt, | ||
sorterByPaths, | ||
@@ -1676,2 +1726,3 @@ filterFlatMap, | ||
subtractDays, | ||
addDays, | ||
previousDayOfWeek, | ||
@@ -1704,4 +1755,4 @@ getSameDateOrPreviousFridayForWeekends, | ||
deepFreeze, | ||
getValueAtPath, | ||
setValueAtPath, | ||
getAt, | ||
setAt, | ||
sorterByPaths, | ||
@@ -1739,2 +1790,3 @@ filterFlatMap, | ||
subtractDays, | ||
addDays, | ||
previousDayOfWeek, | ||
@@ -1741,0 +1793,0 @@ getSameDateOrPreviousFridayForWeekends, |
import { strict as assert } from 'assert' | ||
import { wildcardToRegExp, cloneCopy, promiseAll, } from '../src/lodashExt.js' | ||
import { traverse, getValueAtPath, setValueAtPath } from '../src/jsUtils.js' | ||
import { traverse, getAt, setAt } from '../src/jsUtils.js' | ||
import clone from 'just-clone' | ||
@@ -9,4 +9,4 @@ | ||
//getValueAtPath() | ||
const getValueAtPathSubject = { | ||
//getAt() | ||
const getAtSubject = { | ||
house: | ||
@@ -39,4 +39,4 @@ { | ||
it('getValueAtPath', () => { | ||
const actual = getValueAtPath(getValueAtPathSubject, 'house.room.0.wardrove') | ||
it('getAt', () => { | ||
const actual = getAt(getAtSubject, 'house.room.0.wardrove') | ||
assert.deepStrictEqual( | ||
@@ -51,3 +51,3 @@ actual, | ||
it('getValueAtPath: To get root inform path empty', () => { | ||
it('getAt: To get root inform path empty', () => { | ||
@@ -61,3 +61,3 @@ //Arrange | ||
//Act | ||
const actual = getValueAtPath(3, '') | ||
const actual = getAt(3, '') | ||
//Assert | ||
@@ -69,4 +69,4 @@ assert.strictEqual(actual, expected) | ||
//setValueAtPath() | ||
const setValueAtPathSubject = { | ||
//setAt() | ||
const setAtSubject = { | ||
house: | ||
@@ -99,9 +99,9 @@ { | ||
it('setValueAtPath', () => { | ||
it('setAt', () => { | ||
//Arrange | ||
//subject | ||
const subject = clone(setValueAtPathSubject) | ||
const subject = clone(setAtSubject) | ||
//expected | ||
const expected = clone(setValueAtPathSubject) | ||
const expected = clone(setAtSubject) | ||
expected.house.room[0].wardrove = { test: 'mytest' } | ||
@@ -111,3 +111,3 @@ | ||
let actual = subject | ||
setValueAtPath(actual, 'house.room.0.wardrove', { test: 'mytest' }) | ||
setAt(actual, 'house.room.0.wardrove', { test: 'mytest' }) | ||
@@ -120,8 +120,8 @@ //assert | ||
it('setValueAtPath', () => { | ||
it('setAt', () => { | ||
//Arrange | ||
//subject | ||
const subject = clone(setValueAtPathSubject) | ||
const subject = clone(setAtSubject) | ||
//expected | ||
const expected = clone(setValueAtPathSubject) | ||
const expected = clone(setAtSubject) | ||
expected.house.room[4] = {} | ||
@@ -132,3 +132,3 @@ expected.house.room[4].wardrove = { test: 'mytest' } | ||
let actual = subject | ||
setValueAtPath(actual, 'house.room.4.wardrove', { test: 'mytest' }) | ||
setAt(actual, 'house.room.4.wardrove', { test: 'mytest' }) | ||
@@ -142,3 +142,3 @@ //Assert | ||
it('setValueAtPath simple test with arrays', () => { | ||
it('setAt simple test with arrays', () => { | ||
//Arrange | ||
@@ -155,3 +155,3 @@ //subject | ||
let actual = subject | ||
setValueAtPath(actual, '4.4.4', 'myTest') | ||
setAt(actual, '4.4.4', 'myTest') | ||
@@ -163,9 +163,9 @@ //Assert | ||
it('setValueAtPath complex', () => { | ||
it('setAt complex', () => { | ||
//Arrange | ||
//subject | ||
const subject = clone(setValueAtPathSubject) | ||
const subject = clone(setAtSubject) | ||
//expected | ||
const expected = clone(setValueAtPathSubject) | ||
const expected = clone(setAtSubject) | ||
expected.house.room[4] = [] | ||
@@ -177,3 +177,3 @@ expected.house.room[4][4] = {} | ||
let actual = subject | ||
setValueAtPath(actual, 'house.room.4.4.wardrove', { test: 'mytest' }) | ||
setAt(actual, 'house.room.4.4.wardrove', { test: 'mytest' }) | ||
@@ -180,0 +180,0 @@ //Assert |
export default jsUtils; | ||
declare namespace jsUtils { | ||
export { logWithPrefix }; | ||
export { firstCapital }; | ||
export { varSubsDoubleBracket }; | ||
export { queryObjToStr }; | ||
export { CustomError }; | ||
export { urlCompose }; | ||
export { urlDecompose }; | ||
export { indexOfNthMatch }; | ||
export { colors }; | ||
export { colorMessage }; | ||
export { colorMessageByStatus }; | ||
export { colorByStatus }; | ||
export { findDeepKey }; | ||
export { deepFreeze }; | ||
export { getValueAtPath }; | ||
export { setValueAtPath }; | ||
export { sorterByPaths }; | ||
export { filterFlatMap }; | ||
export { arraySorter }; | ||
export { isPromise }; | ||
export { sleep }; | ||
export { sleepWithValue }; | ||
export { sleepWithFunction }; | ||
export { notTo }; | ||
export { arrayToObject }; | ||
export { arrayOfObjectsToObject }; | ||
export { removeDuplicates }; | ||
export { traverse }; | ||
export { copyPropsWithValue }; | ||
export { copyPropsWithValueUsingRules }; | ||
export { EnumMap }; | ||
export { Enum }; | ||
export { transition }; | ||
export { pushUniqueKey }; | ||
export { pushUniqueKeyOrChange }; | ||
export { pushAt }; | ||
export { memoize }; | ||
export { fillWith }; | ||
export { isDate }; | ||
export { isEmpty }; | ||
export { isStringADate }; | ||
export { formatDate }; | ||
export { dateFormatter }; | ||
export { YYYY_MM_DD_hh_mm_ss_ToUtcDate }; | ||
export { dateToObj }; | ||
export { diffInDaysYYYY_MM_DD }; | ||
export { subtractDays }; | ||
export { previousDayOfWeek }; | ||
export { getSameDateOrPreviousFridayForWeekends }; | ||
export { replaceAll }; | ||
export { cleanString }; | ||
export { repeat }; | ||
export { runEvery }; | ||
export { loopIndexGenerator }; | ||
export { retryWithSleep }; | ||
export { processExit }; | ||
export { logWithPrefix }; | ||
export { firstCapital }; | ||
export { varSubsDoubleBracket }; | ||
export { queryObjToStr }; | ||
export { CustomError }; | ||
export { urlCompose }; | ||
export { urlDecompose }; | ||
export { indexOfNthMatch }; | ||
export { colors }; | ||
export { colorMessage }; | ||
export { colorMessageByStatus }; | ||
export { colorByStatus }; | ||
export { findDeepKey }; | ||
export { deepFreeze }; | ||
export { getAt }; | ||
export { setAt }; | ||
export { sorterByPaths }; | ||
export { filterFlatMap }; | ||
export { arraySorter }; | ||
export { isPromise }; | ||
export { sleep }; | ||
export { sleepWithValue }; | ||
export { sleepWithFunction }; | ||
export { notTo }; | ||
export { arrayToObject }; | ||
export { arrayOfObjectsToObject }; | ||
export { removeDuplicates }; | ||
export { traverse }; | ||
export { copyPropsWithValue }; | ||
export { copyPropsWithValueUsingRules }; | ||
export { EnumMap }; | ||
export { Enum }; | ||
export { transition }; | ||
export { pushUniqueKey }; | ||
export { pushUniqueKeyOrChange }; | ||
export { pushAt }; | ||
export { memoize }; | ||
export { fillWith }; | ||
export { isDate }; | ||
export { isEmpty }; | ||
export { isStringADate }; | ||
export { formatDate }; | ||
export { dateFormatter }; | ||
export { YYYY_MM_DD_hh_mm_ss_ToUtcDate }; | ||
export { dateToObj }; | ||
export { diffInDaysYYYY_MM_DD }; | ||
export { subtractDays }; | ||
export { previousDayOfWeek }; | ||
export { getSameDateOrPreviousFridayForWeekends }; | ||
export { replaceAll }; | ||
export { cleanString }; | ||
export { repeat }; | ||
export { runEvery }; | ||
export { loopIndexGenerator }; | ||
export { retryWithSleep }; | ||
export { processExit }; | ||
} | ||
@@ -65,14 +65,14 @@ export function logWithPrefix(title: any, displayFunc: any): (message: any) => any; | ||
export class CustomError extends Error { | ||
constructor(name?: string, message?: string, data?: { | ||
status: number; | ||
}); | ||
data: { | ||
status: number; | ||
}; | ||
constructor(name?: string, message?: string, data?: { | ||
status: number; | ||
}); | ||
data: { | ||
status: number; | ||
}; | ||
} | ||
export function urlCompose(gatewayUrl: any, serviceName: any, servicePath: any): { | ||
gatewayUrl: any; | ||
serviceName: any; | ||
servicePath: any; | ||
url: any; | ||
gatewayUrl: any; | ||
serviceName: any; | ||
servicePath: any; | ||
url: any; | ||
}; | ||
@@ -82,30 +82,30 @@ export function urlDecompose(url: any, listOfServiceNames: any): any; | ||
export namespace colors { | ||
const red: string; | ||
const green: string; | ||
const yellow: string; | ||
const cyan: string; | ||
const blue: string; | ||
const reset: string; | ||
const reverse: string; | ||
const fgBlack: string; | ||
const fgRed: string; | ||
const fgGreen: string; | ||
const fgYellow: string; | ||
const fgBlue: string; | ||
const fgMagenta: string; | ||
const fgCyan: string; | ||
const fgWhite: string; | ||
const bgBlack: string; | ||
const bgRed: string; | ||
const bgGreen: string; | ||
const bgYellow: string; | ||
const bgBlue: string; | ||
const bgMagenta: string; | ||
const bgCyan: string; | ||
const bgWhite: string; | ||
const bright: string; | ||
const dim: string; | ||
const underscore: string; | ||
const blink: string; | ||
const hidden: string; | ||
const red: string; | ||
const green: string; | ||
const yellow: string; | ||
const cyan: string; | ||
const blue: string; | ||
const reset: string; | ||
const reverse: string; | ||
const fgBlack: string; | ||
const fgRed: string; | ||
const fgGreen: string; | ||
const fgYellow: string; | ||
const fgBlue: string; | ||
const fgMagenta: string; | ||
const fgCyan: string; | ||
const fgWhite: string; | ||
const bgBlack: string; | ||
const bgRed: string; | ||
const bgGreen: string; | ||
const bgYellow: string; | ||
const bgBlue: string; | ||
const bgMagenta: string; | ||
const bgCyan: string; | ||
const bgWhite: string; | ||
const bright: string; | ||
const dim: string; | ||
const underscore: string; | ||
const blink: string; | ||
const hidden: string; | ||
} | ||
@@ -117,4 +117,4 @@ export function colorMessage(message: any, color: any): string; | ||
export function deepFreeze(o: any): any; | ||
export function getValueAtPath(obj: any, valuePath: any): any; | ||
export function setValueAtPath(obj: any, valuePath: any, value: any): string; | ||
export function getAt(obj: any, valuePath: any): any; | ||
export function setAt(obj: any, valuePath: any, value: any): string; | ||
export function sorterByPaths(paths: any, isAsc?: boolean): (objA: any, objB: any) => number; | ||
@@ -139,2 +139,3 @@ export function filterFlatMap(mapWithUndefinedFilterFun: any, data: any): any[]; | ||
* traverse.delete: delete the current node | ||
* traverse.match(stringQuery, reviverPath) return true if reviverPath match query string | ||
* | ||
@@ -146,8 +147,8 @@ * @param objIni The object to traverse. | ||
*/ | ||
export function traverse(objIni: any, reviver: (value:any, path:string[], parent:any, prop:string) => any, pureFunction?: boolean): any | ||
export function traverse(objIni: any, reviver: (value: any, path: string[], parent: any, prop: string) => any, pureFunction?: boolean): any | ||
export namespace traverse { | ||
export const skip: symbol; | ||
export const stop: symbol; | ||
const _delete: symbol; | ||
export { _delete as delete }; | ||
export const skip: symbol; | ||
export const stop: symbol; | ||
const _delete: symbol; | ||
export { _delete as delete }; | ||
} | ||
@@ -175,3 +176,3 @@ /** | ||
*/ | ||
export function traverseVertically(functionToRun: (verticalSlice: object, runIndex:number) => any, verFields:string[], toTraverse:any[]):void | ||
export function traverseVertically(functionToRun: (verticalSlice: object, runIndex: number) => any, verFields: string[], toTraverse: any[]): void | ||
@@ -181,12 +182,12 @@ export function copyPropsWithValue(objDest: any, shouldUpdateOnlyEmptyFields?: boolean): (input: any) => any; | ||
export class EnumMap { | ||
constructor(values: any); | ||
get(target: any, prop: any): any; | ||
set(_undefined: any, prop: any): void; | ||
invert(): EnumMap; | ||
constructor(values: any); | ||
get(target: any, prop: any): any; | ||
set(_undefined: any, prop: any): void; | ||
invert(): EnumMap; | ||
} | ||
export class Enum { | ||
constructor(values: any, rules: any); | ||
get: (_target: any, prop: any) => any; | ||
set: (_undefined: any, prop: any, value: any) => boolean; | ||
getValue: () => any; | ||
constructor(values: any, rules: any); | ||
get: (_target: any, prop: any) => any; | ||
set: (_undefined: any, prop: any, value: any) => boolean; | ||
getValue: () => any; | ||
} | ||
@@ -201,4 +202,4 @@ export function transition(states: any, events: any, transitions: any): { | ||
export function memoize(): { | ||
memoizeMap: (func: any, ...params: any[]) => any; | ||
memoizeWithHashFun: (func: any, hashFunc: any, ...params: any[]) => any; | ||
memoizeMap: (func: any, ...params: any[]) => any; | ||
memoizeWithHashFun: (func: any, hashFunc: any, ...params: any[]) => any; | ||
}; | ||
@@ -213,9 +214,9 @@ export function fillWith(mapper: any, lenOrWhileTruthFun: any): any[]; | ||
export function dateToObj(date: any): { | ||
YYYY: number; | ||
MM: number; | ||
DD: number; | ||
hh: number; | ||
mm: number; | ||
ss: number; | ||
mil: number; | ||
YYYY: number; | ||
MM: number; | ||
DD: number; | ||
hh: number; | ||
mm: number; | ||
ss: number; | ||
mil: number; | ||
}; | ||
@@ -229,11 +230,11 @@ export function diffInDaysYYYY_MM_DD(iniDate: any, endDate: any): number; | ||
export function repeat(numberOfTimes: any): { | ||
times: (funToRepeat: any) => any[]; | ||
awaitTimes: (funToRepeat: any) => Promise<any[]>; | ||
value: (value: any) => any[]; | ||
times: (funToRepeat: any) => any[]; | ||
awaitTimes: (funToRepeat: any) => Promise<any[]>; | ||
value: (value: any) => any[]; | ||
}; | ||
export function runEvery(period: any): { | ||
calls: (runFunc: any) => { | ||
(...args: any[]): any; | ||
reset(): number; | ||
}; | ||
calls: (runFunc: any) => { | ||
(...args: any[]): any; | ||
reset(): number; | ||
}; | ||
}; | ||
@@ -240,0 +241,0 @@ export function loopIndexGenerator(initValue: any, iterations: any): Generator<any, void, unknown>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220520
6672