Socket
Socket
Sign inDemoInstall

@antv/util

Package Overview
Dependencies
Maintainers
7
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/util

A common util collection for antv projects


Version published
Weekly downloads
244K
decreased by-11.11%
Maintainers
7
Weekly downloads
 
Created

What is @antv/util?

@antv/util is a utility library that provides a collection of functions for common programming tasks. It is part of the AntV ecosystem, which is a suite of data visualization tools. The library includes functions for data manipulation, type checking, deep cloning, and more.

What are @antv/util's main functionalities?

Type Checking

The @antv/util package provides various type-checking functions to determine the type of a given value. In this example, `isString` is used to check if a value is a string.

const isString = require('@antv/util/lib/type/isString');
console.log(isString('Hello World')); // true
console.log(isString(123)); // false

Deep Clone

The `deepClone` function creates a deep copy of an object, ensuring that nested objects are also cloned. This is useful for creating independent copies of complex data structures.

const deepClone = require('@antv/util/lib/deepClone');
const obj = { a: 1, b: { c: 2 } };
const clonedObj = deepClone(obj);
console.log(clonedObj); // { a: 1, b: { c: 2 } }
console.log(clonedObj === obj); // false

Data Manipulation

The `groupBy` function allows you to group an array of objects by a specified key. This is useful for organizing data into categories or groups.

const groupBy = require('@antv/util/lib/array/groupBy');
const data = [
  { category: 'fruit', name: 'apple' },
  { category: 'fruit', name: 'banana' },
  { category: 'vegetable', name: 'carrot' }
];
const groupedData = groupBy(data, 'category');
console.log(groupedData); // { fruit: [{ category: 'fruit', name: 'apple' }, { category: 'fruit', name: 'banana' }], vegetable: [{ category: 'vegetable', name: 'carrot' }] }

Other packages similar to @antv/util

Keywords

FAQs

Package last updated on 14 Sep 2018

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