@zollty/zollty-util

1.0.9 • Public • Published

zollty-util.js

npm npm

A small JavaScript utility library.

Package with rollup.js, exported as iife amd cmd cjs umd es6 module.

Support most modern browsers, not include IE. Support Node 8+.

Install

npm install @zollty/zollty-util

API

See this dir

Usage

import {
  toMapKey,
  toMapValue
} from '@zollty/zollty-util';

console.log(toMapKey); // Function
console.log(toMapValue); // Function

Can also import like

import ztu from '@zollty/zollty-util';

console.log(ztu.toMapKey); // Function
console.log(ztu.toMapValue); // Function

or like this

import toMapKey from '@zollty/zollty-util/toMapKey';
import toMapValue from '@zollty/zollty-util/toMapValue';

console.log(toMapKey); // Function
console.log(toMapValue); // Function

toMapKey

get the key set of a map and a value array:

// suppose have data
const data = {"s":5, "a": 4, "b": 3, "c": 2, "d": 1}
const vals = [4 ,3, 2]
// we want to get the key set ["a", "b", "c"]
const keys = ztu.toMapKey(vals, data);

toMapValue

get the value set of a map and a key array:

// suppose have data
const data = {"s":5, "a": 4, "b": 3, "c": 2, "d": 1}
const keys = ["a", "b", "c"]
// we want to get the value set [4, 3, 2]
const vals = ztu.toMapValue(keys, data);

more examples

please see the code directly.

License

Released under the MIT Licenses.

Package Sidebar

Install

npm i @zollty/zollty-util

Weekly Downloads

1

Version

1.0.9

License

MIT

Unpacked Size

41.1 kB

Total Files

33

Last publish

Collaborators

  • zollty