Skip to content

fxgao/zollty-util.js

 
 

Repository files navigation

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.

About

A small JavaScript utility library can used under NodeJS and the browser. Package with rollup.js, exported as es6,cjs,amd,cmd,umd,iife module.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 92.4%
  • HTML 7.6%