js-awe
Advanced tools
Comparing version 1.0.65 to 1.0.66
@@ -16,3 +16,3 @@ 'use strict'; | ||
exports.subtractDays = exports.diffInDaysYYYY_MM_DD = exports.dateToObj = exports.YYYY_MM_DD_hh_mm_ss_ToUtcDate = exports.dateFormatter = exports.formatDate = exports.isStringADate = exports.isEmpty = exports.isDate = exports.fillWith = exports.memoize = exports.pushAt = exports.pushUniqueKeyOrChange = exports.pushUniqueKey = exports.transition = exports.Enum = exports.EnumMap = exports.copyPropsWithValueUsingRules = exports.copyPropsWithValue = exports.project = exports.traverseVertically = exports.traverse = exports.removeDuplicates = exports.arrayOfObjectsToObject = exports.arrayToObject = exports.notTo = exports.sleepWithFunction = exports.sleepWithValue = exports.sleep = exports.isPromise = exports.arraySorter = exports.filterFlatMap = exports.sorterByPaths = exports.setAt = exports.getAt = exports.deepFreeze = exports.findDeepKey = exports.colorByStatus = exports.colorMessageByStatus = exports.colorMessage = exports.colors = exports.indexOfNthMatch = exports.urlDecompose = exports.urlCompose = exports.createCustomErrorClass = exports.CustomError = exports.queryObjToStr = exports.varSubsDoubleBracket = exports.firstCapital = exports.logWithPrefix = void 0; | ||
exports.processExit = exports.retryWithSleep = exports.loopIndexGenerator = exports.oneIn = exports.repeat = exports.cleanString = exports.replaceAll = exports.setDateToMidnight = exports.isDateMidnight = exports.getSameDateOrPreviousFridayForWeekends = exports.previousDayOfWeek = exports.addDays = void 0; | ||
exports._ = exports.processExit = exports.retryWithSleep = exports.loopIndexGenerator = exports.oneIn = exports.repeat = exports.cleanString = exports.replaceAll = exports.setDateToMidnight = exports.isDateMidnight = exports.getSameDateOrPreviousFridayForWeekends = exports.previousDayOfWeek = exports.addDays = void 0; | ||
const just_clone_1 = __importDefault(require("just-clone")); | ||
@@ -1546,2 +1546,19 @@ const jsonpath_plus_1 = require("jsonpath-plus"); | ||
exports.processExit = processExit; | ||
function _(scope, fn) { | ||
return (...params) => { | ||
let result; | ||
try { | ||
globalThis.$ = scope; | ||
result = fn(...params); | ||
} | ||
catch (e) { | ||
throw e; | ||
} | ||
finally { | ||
globalThis.$ = undefined; | ||
} | ||
return result; | ||
}; | ||
} | ||
exports._ = _; | ||
const jsUtils = { | ||
@@ -1608,4 +1625,5 @@ logWithPrefix, | ||
retryWithSleep, | ||
processExit | ||
processExit, | ||
_ | ||
}; | ||
exports.default = jsUtils; |
@@ -1,2 +0,2 @@ | ||
import { Chrono, sleepWithFunction } from 'js-awe' | ||
import { Chrono, sleep } from 'js-awe' | ||
@@ -6,51 +6,22 @@ let chrono = Chrono() | ||
chrono.time('step1') | ||
await sleep(650) | ||
chrono.timeEnd('step1') | ||
tasks().then(()=>{ | ||
chrono.timeEnd('step1') | ||
chrono.report() | ||
}) | ||
await sleep(20) | ||
chrono.time('step2') | ||
await sleep(12) | ||
chrono.time('step3') | ||
async function tasks() | ||
{ | ||
await sleep(500) | ||
chrono.timeEnd('step3') | ||
await sleepWithFunction( | ||
650, | ||
() => { | ||
chrono.timeEnd('step1') | ||
} | ||
) | ||
await sleep(100) | ||
chrono.timeEnd('step2') | ||
await sleepWithFunction( | ||
20, | ||
() => { | ||
chrono.time('step2') | ||
} | ||
) | ||
await sleep(15) | ||
chrono.time('step1') | ||
await sleepWithFunction( | ||
12, | ||
() => { | ||
chrono.time('step3') | ||
} | ||
) | ||
chrono.timeEnd('step1') | ||
await sleepWithFunction( | ||
500, | ||
() => { | ||
chrono.timeEnd('step3') | ||
} | ||
), | ||
await sleepWithFunction( | ||
100, | ||
() => { | ||
chrono.timeEnd('step2') | ||
} | ||
), | ||
await sleepWithFunction( | ||
15, | ||
() => { | ||
chrono.time('step1') | ||
} | ||
) | ||
} | ||
chrono.report() |
@@ -1461,2 +1461,18 @@ 'use strict'; | ||
} | ||
function _(scope, fn) { | ||
return (...params) => { | ||
let result; | ||
try { | ||
globalThis.$ = scope; | ||
result = fn(...params); | ||
} | ||
catch (e) { | ||
throw e; | ||
} | ||
finally { | ||
globalThis.$ = undefined; | ||
} | ||
return result; | ||
}; | ||
} | ||
const jsUtils = { | ||
@@ -1523,5 +1539,6 @@ logWithPrefix, | ||
retryWithSleep, | ||
processExit | ||
processExit, | ||
_ | ||
}; | ||
export default jsUtils; | ||
export { logWithPrefix, firstCapital, varSubsDoubleBracket, queryObjToStr, CustomError, createCustomErrorClass, urlCompose, urlDecompose, indexOfNthMatch, colors, colorMessage, colorMessageByStatus, colorByStatus, findDeepKey, deepFreeze, getAt, setAt, sorterByPaths, filterFlatMap, arraySorter, isPromise, sleep, sleepWithValue, sleepWithFunction, notTo, arrayToObject, arrayOfObjectsToObject, removeDuplicates, traverse, traverseVertically, project, copyPropsWithValue, copyPropsWithValueUsingRules, EnumMap, Enum, transition, pushUniqueKey, pushUniqueKeyOrChange, pushAt, memoize, fillWith, isDate, isEmpty, isStringADate, formatDate, dateFormatter, YYYY_MM_DD_hh_mm_ss_ToUtcDate, dateToObj, diffInDaysYYYY_MM_DD, subtractDays, addDays, previousDayOfWeek, getSameDateOrPreviousFridayForWeekends, isDateMidnight, setDateToMidnight, replaceAll, cleanString, repeat, oneIn, loopIndexGenerator, retryWithSleep, processExit }; | ||
export { logWithPrefix, firstCapital, varSubsDoubleBracket, queryObjToStr, CustomError, createCustomErrorClass, urlCompose, urlDecompose, indexOfNthMatch, colors, colorMessage, colorMessageByStatus, colorByStatus, findDeepKey, deepFreeze, getAt, setAt, sorterByPaths, filterFlatMap, arraySorter, isPromise, sleep, sleepWithValue, sleepWithFunction, notTo, arrayToObject, arrayOfObjectsToObject, removeDuplicates, traverse, traverseVertically, project, copyPropsWithValue, copyPropsWithValueUsingRules, EnumMap, Enum, transition, pushUniqueKey, pushUniqueKeyOrChange, pushAt, memoize, fillWith, isDate, isEmpty, isStringADate, formatDate, dateFormatter, YYYY_MM_DD_hh_mm_ss_ToUtcDate, dateToObj, diffInDaysYYYY_MM_DD, subtractDays, addDays, previousDayOfWeek, getSameDateOrPreviousFridayForWeekends, isDateMidnight, setDateToMidnight, replaceAll, cleanString, repeat, oneIn, loopIndexGenerator, retryWithSleep, processExit, _ }; |
{ | ||
"name": "js-awe", | ||
"version": "1.0.65", | ||
"version": "1.0.66", | ||
"homepage": "https://github.com/josuamanuel/js-awe", | ||
@@ -5,0 +5,0 @@ "author": "josuamanuel@hotmail.com", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1828035
46719