Socket
Socket
Sign inDemoInstall

utile

Package Overview
Dependencies
4
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

utile


Version published
Maintainers
1
Install size
126 kB
Created

Package description

What is utile?

The 'utile' npm package is a utility library that provides a collection of useful functions for various common tasks in Node.js development. It includes features for deep cloning, merging objects, asynchronous flow control, and more.

What are utile's main functionalities?

Deep Cloning

The 'clone' function allows you to create a deep copy of an object, ensuring that nested objects are also cloned rather than referenced.

const utile = require('utile');
const obj = { a: 1, b: { c: 2 } };
const clone = utile.clone(obj);
console.log(clone); // { a: 1, b: { c: 2 } }

Merging Objects

The 'mixin' function merges properties from one or more objects into a target object, with later objects overwriting properties of earlier ones.

const utile = require('utile');
const obj1 = { a: 1, b: 2 };
const obj2 = { b: 3, c: 4 };
const merged = utile.mixin(obj1, obj2);
console.log(merged); // { a: 1, b: 3, c: 4 }

Asynchronous Flow Control

The 'async.parallel' function allows you to run multiple asynchronous tasks in parallel and collect their results once all tasks have completed.

const utile = require('utile');
const tasks = [
  function (callback) { setTimeout(() => callback(null, 'one'), 200); },
  function (callback) { setTimeout(() => callback(null, 'two'), 100); }
];
utile.async.parallel(tasks, function (err, results) {
  console.log(results); // ['one', 'two']
});

Other packages similar to utile

Readme

Source

FAQs

Last updated on 31 Oct 2011

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc