1.0.9 • Published 5 years ago

@zollty/zollty-util v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

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.

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago