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 🙏

© 2025 – Pkg Stats / Ryan Hefner

alamo-js

v1.0.5

Published

alamoJS,thanks my JS big Bro,(cover for a famous car company )

Downloads

27

Readme

Alamo-js

一些不良个人习惯,超轻量级js业务开发库,封装了一些常用js操作函数。(持续更新)

Installation

using npm:

$ npm i --save alamo-js

in Browser

<script src="js/alamo-js.js"></script>

in Vue

const alamo = require('alamo-js')

Support

特别鸣谢:某知名大厂不方便透露姓名的高级前端开发工程师

开发文档

示例

//判断设备类型
const machine_type =  alamo.checkPort()
console.log(machine_type)
// Pc 
// iOS
// weixin
// Android

以下示例将省略alamo前缀

setCookie

setCookie('id', 11);
// 无过期时间
setCookie('id', 11, {expired: 10});
// 十分钟过期
setCookie('id', 11, {path: '/xixi'});
// cookie设置在路径/xixi下,只有访问/xixi的页面才可以访问到
setCookie('id', 11, {baseUrl: 'baidu.com'});
// 域名设置在baidu.com下,所有baidu.com次级域名均可访问到

getCookie

// 获取Cookie
getCookie('id');
// => 11

delCookie

// 删除Cookie
delCookie('id');
delCookie('id', {domain: 'test.com'});
delCookie('id', {path: '/your-path'});

encodeURI

// 与原生功能类似,允许使用更多数据类型转码
encodeURI(['哈哈', '学习']);
// => ['jfgljfgladl;fgjl;kdjfg', 'dalksdj;aldjal;ksdj']
encodeURI({a: '哈哈', b: '学习']);
// => {a: 'jfgljfgladl;fgjl;kdjfg', b: 'dalksdj;aldjal;ksdj'}

getURLParam

// 假设当前页面链接为 http://www.baidu.com?a=1&b=2
alamo.getURLParam("a")
// => 1

jsonToUrlParam & urlParamToJson

//json格式转url参数
urlParamToJson({a: '1', b: '2'});
// => a=1&b=2
// 两极反转
urlParamToJson('a=1&b=2');
// => {a: '1', b: '2'}

getJson

// 获取JSON数据
getJson(object, 'a');
// => 1
getJson(object, 'b[1]');
// => 2

copyToClipboard(暂时废弃)

// 复制到粘贴板
const text = 'alamo'
copyToClipboard(text)

checkPort

//判断设备类型
const machine_type =  alamo.checkPort()
console.log(machine_type)
// Pc 
// iOS
// weixin
// Android

debounce

//防抖
debounce (func, delay)

throttle

// 节流 
throttle (func, delay) 

eq

// 判断两个对象,数组是否相等
eq(obj,obj) // => true || false

eq(arr,arr) // => true || false

checkName

// 名字正则 
// 中文名
checkName('汽车人')
// => true
// 英文名
checkName('name','EN')
// => true

checkPhone

// 电话正则 
checkPhone(18144773281)
// 增强限制(13-18开头)
checkPhone(18144773281,2)
// 工信部限制
checkPhone(18144773281,3)
// => true  || false

stayTwoNum

// 金额保留两位小数点 (四舍五入)
stayTwoNum(12345)
// 12345.00
stayTwoNum(123.45678)
// 123.45

tuomin

// 名字或电话脱敏
tuomin(18144773281)
// 181****3281
tuomin('阿拉莫')
// 阿*莫

moneyToCn

// 金额转中文
moneyToCn(12345)
// 一万二千三百四十五元整