npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

highly-tools

v1.1.3

Published

工具箱,对常用功能的封装实现

Readme

tools release MIT

工具箱,对常用功能的封装实现

DOC

How to use ?

npm i highly-tools

使用支持

  • CommonJS
  • ES6 module
import tools from 'highly-tools'
const { tools } = require('highly-tools');

Api

  • queue
  • group
  • mapTree
  • flatten
  • iterator
  • throttle
  • debounce
  • memorize
  • cloneDeep

waiting for doc...(It's been supported)

  • curry
  • split
  • toDate
  • compose
  • isEqual
  • isEmpty
  • calcTime
  • resetTree
  • getArrMax
  • findParent
  • simpleClone
  • fixReference
  • getArrMaxIndex
  • asyncErrorCatch

queue

串行、并行、全部完成

// 需要对异步函数做一些修改(包一层即可,略显鸡肋...) 如下:
import { queue } from 'highly-tools';

const fn1 = (cb) => {
    setTimeout(() => {
        console.log('fn1');
        cb && cb();
    }, 1000);
};

const fn2 = (cb) => {
    setTimeout(() => {
        console.log('fn2');
        cb && cb();
    }, 3000);
};

const fn3 = (cb) => {
    setTimeout(() => {
        console.log('fn3');
        cb && cb();
    }, 1000);
};

asyncQueue = [fn1, fn2, fn3];

const q = queue();
q.add(...asyncQueue);

// 串行
q.runAsync();

// 并行
q.run();

//全部完成
q.runAll().then(() => {
    console.log('全部完成了');
});

mapTree

tree的遍历

import { mapTree } from 'highly-tools';

let tree = {
     value: 0,
     children: []
 };

mapTree(tree, console.log);

flatten

数组扁平化

import { flatten } from 'highly-tools';

let arr = [1, 2, [1, 3, 4, 5, [3, 4], 5, 7], 668];
flatten(arr);

group

一维数组转多维数组

import { group } from 'highly-tools';

arr = group([1, 2, 3, 4, 5], 2);

iterator

数组转迭代器对象

import { iterator } from 'highly-tools';

iterator([1, 2, 3]);

throttle

函数节流,控制执行频率

import { throttle } from 'highly-tools';

/**
 * 函数节流
 * @param fn        频繁触发的函数    type Function
 * @param delay     延迟            type Number
 * @param limit     必触发时间限制   type Number
 */
throttle(() => {
    // your fn
}, 300);

debounce

函数防抖,频繁触发只触发一次

import { debounce } from 'highly-tools';

/**
 * 函数防抖
 * @param   fn        频繁触发的函数   type Function
 * @param   delay     延迟           type Number
 * @param   immediate 是否立即触发一次 type Boolean
 */
debounce(() => {
    // your fn
}, 300);

fixReference

循环引用解除

import { fixReference } from 'highly-tools';

/**
 * 解除循环引用
 * @param object    循环引用对象
 * @param replacer  重构对象的回调函数
 * @returns {{_$}}  解除循环引用的占位对象
 */
let a = {};
let b = {};
a.b = b;
b.a = a;
fixReference(b, callback);

cloneDeep

深拷贝

import { cloneDeep } from 'highly-tools';

/**
 * 深拷贝
 * @param obj           被拷贝对象
 * @param fixReference  是否考虑循环引用
 * @returns {*}
 */
// 普通对象深拷贝
let obj = {a: 3, b: [1, 2, 3]}
cloneDeep(obj);
// 考虑循环引用的深拷贝
let a = {};
let b = {};
a.b = b;
b.a = a;
cloneDeep(b, true);

memorize

函数记忆

import { memorize } from 'highly-tools';

// 函数记忆
const add = (a, b) => a + b
const memorizeAdd = memorize(add);
memorizeAdd(1, 2)

License

highly-tools is MIT licensed.