Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

utilsac

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utilsac

Utility functions

  • 15.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

utilsac

Utility functions

Installation

npm i utilsac

Usage

The source code is the documentation.

utility.js

import {
    createDebounced,
    createThrottled,
    throttledWithLast,
    chainPromiseNTimes,
    chainPromises,
    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";

deep.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";

deepEqual example

const personA = { email: 'example@email.com', name: { firstname: 'James', lastname: 'William' }};

const personB = { email: 'example@email.com', name: { firstname: 'James', lastname: 'William' }};

deepEqual(personA, personB); //  true

typeCast.js

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";

browserUtility.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

About

Changelog

Changelog

License

CC0

Keywords

FAQs

Package last updated on 28 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc