Utility functions
The source code is the documentation.
import {
createDebounced,
createThrottled,
throttledWithLast,
chainPromiseNTimes,
chainPromises,
forceThrottlePromiseCreator,
throttlePromiseCreator,
throttlePromiseCreatorSelfClean,
somePromisesParallel,
chainRequestAnimationFrame,
decorateForceSequential,
doNTimes,
timeFunction,
timePromise,
memoizeAsStrings,
createTemplateTag,
bytesLengthFromString,
assignSelected,
} from "utilsac";
// deno
import {
createDebounced,
createThrottled,
throttledWithLast,
chainPromises,
somePromisesParallel,
chainRequestAnimationFrame,
doNTimes,
chainPromiseNTimes,
timeFunction,
timePromise,
memoizeAsStrings,
createTemplateTag,
bytesLengthFromString,
} from "https://unpkg.com/utilsac/utility.js";
Consider structuredClone if you need deepCopy
import {
deepCopy,
deepCopyAdded,
deepAssign,
deepAssignAdded,
deepEqual,
deepEqualAdded,
deepDifference,
} from "utilsac/deep.js";
// deno
import {
deepCopy,
deepCopyAdded,
deepAssign,
deepAssignAdded,
deepEqual,
deepEqualAdded,
deepDifference,
} from "https://unpkg.com/utilsac/deep.js";
const personA = { email: '[email protected]', name: { firstname: 'James', lastname: 'William' }};
const personB = { email: '[email protected]', name: { firstname: 'James', lastname: 'William' }};
deepEqual(personA, personB); // true
import {
stringFromArrayBuffer,
arrayBufferFromBlob,
stringFromBlob,
stringFromArray,
setFromArray,
mapFromObject,
} from "utilsac/typeCast.js";
// deno
import {
deepCopy,
deepCopyAdded,
deepAssign,
deepAssignAdded,
deepEqual,
deepEqualAdded,
deepDifference,
} from "https://unpkg.com/utilsac/typeCast.js";
import {
evalGlobal,
downloadBlob,
} from "utilsac/browserUtility.js";
evalGlobal(`window.x = 2 ** 10`);
After the Promise is resolved the code has executed in global scope.
evalGlobal(`
import sin form "./x.js";
window.x = sin(Math.PI)
`, `module`);
Use optional second argument with module
to be able to use static imports