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

@amipei/adam

v1.3.2

Published

轮子库

Readme

amipei-adamjs

Install/安装

You can install with npm(你可以使用npm安装:)

$ npm install @amipei/adam

Usage/用法

import { base } from '@amipei/adam'  //base lib  
import { array } from '@amipei/adam'  //数组处理
import { cookie } from '@amipei/adam'  //cookie处理
import { dom }array from '@amipei/adam'  //dom处理
import { url } from '@amipei/adam'  //url处理

功能

isString(obj/string)

  • Function for Determine if it is a string/string object
base.isString('string') //return true

debounce(callback,time)

  • Function for avoiding shake
  • test example:
describe('debounce', () => {
  test('多次调用', (done) => {
    let count = 0
    function callback() {
      count += 1
      expect(count).toBe(1)
      done()
    }
    const db = debounce(callback)
    for (let i = 0; i < 100; i++) {
      db()
    }
  })
  test('超出延迟调用', (done) => {
    let count = 0
    function callback() {
      count += 1
    }
    const db = debounce(callback)
    db() //300ms后  count 加  1  = 1
    setTimeout(() => {
      db()
    }, 300); //300ms后开始执行db()  600ms后count 加 1  = 2
    setTimeout(() => {
      expect(count).toBe(2)
      done()
    }, 800);
  })
})

removeItemByIndex(index, arr)

  • Function for Deleting item by index
array.removeItemByIndex(1, [1,2,3]) //return [1,3]

setCookie(key,value)

  • Function for set cookie
cookie.setCookie('name','amipei')

getCookie(key)

  • Function for get cookie
cookie.getCookie('name') //return  amipei

delCookie(key)

  • Function for del cookie
cookie.delCookie('name')

$(string)

  • Function for select element
dom.$('#id')   //return {DOM|undefined}

removeNode(node)

  • Function for deleting dom node
dom.removeNode(node) //return {Dom}

removeClass(node, className)

  • Function for deleting className of node
dom.removeClass(node,'className')

addClass(node, className)

  • Function for add className
dom.addClass(node,'className')

insertAfter(node)

  • Function for inserting the node after the target node
dom.insertAfter(node, target)

getAbsoluteUrl(url)

  • Function for get absolute url
url.getAbsoluteUrl('/amipei') //return http://www.amipei.xyz/amipei

serialize(data)

  • Function for turn the object into a url string
url.getAbsoluteUrl({name:'amipei'}) //?name=amipei

query(url)

  • Function for gets the value of the specified name in the specified querystring
url.query('name', '?name=js') //return 'js'