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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gx-instant

v1.1.2

Published

一款将项目常见功能进行抽取封装,避免重复开发,提升开发效率的插件

Downloads

22

Readme

简介

gx-instant 是一款npm插件,它将项目常见功能进行抽取封装,避免重复开发,提升开发效率,同时函数式编程也让代码更简洁优雅

gx-instantgx 是人名缩写,而 instant快速的立刻的速溶咖啡速食的 的含义,所以该插件的目的不是像诸如 js-cookieday.js 等专业或全面的解决一类问题,而是将项目中常用的业务功能进行提炼、归纳、进行封装、避免重复开发,提升开发效率; 同时尽可能的函数式编程也能让代码更简洁优雅

作用

  • 提炼业务中常用功能,避免重复开发,提升开发效率
  • 函数式编程,让代码更简洁优雅

场景

  • 重复代码不想写
  • 代码不够优雅

当前功能

  • 基础:包含一些基础api
  • 断言:包含一些判断是否相等,是否属于某类型的api
  • 计算:包含四则运算,舍入api,修复了js浮点数精度问题,支持批量计算
  • 存储:包含对localStorage,sessionStorage,cookie,indexDB的常用操作,支持批量设置
  • 正则匹配:包含了一些常用的通过正则验证字符串的api,如邮箱,链接,手机号,身份证号等
  • 转换:提供了一些格式化操作,如日期格式化,json对象转查询字符串,深浅拷贝,序列化反序列化等
  • 平台:包含了获取当前运行环境的api,如浏览器信息,操作系统信息,域名等
  • 优化:包含了常见优化api,防抖节流等
  • 场景:包含了一些常见业务场景的api,如滚动条滚动,元素拖拽,设置元素样式,设置rem,判断元素是否在可视区,分页,触底加载,复制粘贴,导出表格等
  • 随机性:包含一些产生随机数据的api
  • 快捷键:包含了一些快捷键绑定api
  • 请求:包含一些请求api
  • 通用工具:包含一些通用方法,如数据个数统计,浏览器打印彩色日志,睡眠等

安装方式

//npm
npm install gx-instant
//pnpm
pnpm add gx-instant
//yarn
yarn add gx-instant

更新记录

v1.1.1 2024-4-09

  • 新增快捷键模块,包含常用的快捷键绑定api
  • 新增请求模块,包含常用的请求api
  • 基础模块,新增getSizegetFileSize,用于获取数据内存大小
  • 转换模块,新增文件大小转换api,文件流转换api
  • 部分方法优化

v1.0.1 2024-4-02

修复错误依赖项bug

v1.0.0 2024-4-02

废弃对js-cookielocalforage的依赖

  • 存储模块:优化setCookie(设置cookie)、getCookie(获取cookie)、removeCookie(删除cookie)、 setIndexDB(设置indexDB)、getIndexDB(获取indexDB)、removeIndexDB(删除indexDB)等方法

v0.0.9 2024-4-01

废弃对currency.jsdecimal.jsmoment.js的依赖

  • 格式化模块:优化toRMB(数字转人民币)、toUSD(数字转美元)、moneyToNumber(金额转数字)等方法
  • 计算模块:优化add(加法)、sub(减法)、mul(乘法)、div(除法)等方法
  • 转换模块:优化toDateStr(日期格式化)、toTimeStr(时间格式化)、toDateTimeStr(日期时间格式化)等方法

v0.0.7 2024-3-29

  • 新增API
    • 基础模块:新增getFileType,判断文件类型
    • 断言模块
      • 新增数据类型判断方法:isFunction用来判断是否为Function类型;isType:用来判断是否属于某类型;isInstance:判断是否属于某实例
      • 新增文件类型判断方法:isImgisVideoisAudioisDocisExcelisPDFisZIP
    • 转换模块:新增删除对象属性方法:deletes
    • 优化模块:新增计算缓存方法:computed;新增柯里化方法:curry
    • 场景模块:新增复制内容到剪贴板方法:copyClipboard
    • 通用工具模块:新增判断方法是否执行成功方法:runner

官方文档