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

huyue-tools-map

v1.0.4

Published

javascript 仿照 java or es6 map数据格式

Readme

使用说明

仿照java 和 es6 的map数据结构

  1. 数组存储的按索引值的计算问题。 每次要写个循环,增加思考和调试成本;

  2. 如何利用 elements 来正确的使用,取决于使用场景;

  3. 当你new一个对象后你会得到一个对象,里面的数据在 new.elements 上面 var hymap = new HyMap(testArr); hymap.elements

  4. 安装

npm i huyue-tools-map --save
  1. 引入
import HyMap from 'huyue-tools-map'
  1. 使用
// ### new的时候可以传人一个数组 或者 对象
var testArr = [
    {
        code:'1',
        name:'name',
        isShow:'1'
    },
    {
        code:'b',
        name:'2',
        isShow:'1'
    },
    {
        code:'asdf',
        name:'asdf',
        isShow:'1'
    }
]
var testObject = {
    name:'章三',
    sex:'man',
    eag:[
        {
            name:'test'
        }
    ]
}

var hymap = new HyMap(testArr);
console.log(hymap.elements);

hymap.size(); //获取Map元素个数
hymap.isEmpty(); //判断Map是否为空
hymap.clear(); //删除Map所有元素
hymap.put(key, value) //向Map中增加元素(key, value)  
hymap.remove(key) //删除指定key的元素,成功返回true,失败返回false 
hymap.get(key) //获取指定key的元素值value,失败返回null 
hymap.element(index) //获取指定索引的元素(使用element.key,element.value获取key和value),失败返回null 
hymap.containsKey(key) //判断Map中是否含有指定key的元素 
hymap.containsValue(value) //判断Map中是否含有指定value的元素 
hymap.keys() //获取Map中所有key的数组(array) 
hymap.values() //获取Map中所有value的数组(array) 

  1. 更新
npm update huyue-tools-map