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

commonts-toolkit

v2.7.0

Published

ts常用工具包

Downloads

8

Readme

npm 方法库

介绍

pc 移动端通用方法库

安装教程

cnpm install commonts-toolkit --save

使用说明

  1. 在 tsconfig.json 中配置 "files": ["node_modules/commonts-toolkit/dist/index.d.ts"]
  2. 在 src/global.tsx 中引入 import 'commonts-toolkit';

注意事项

  1. 如果是 js 版本使用,会提示找不到 TOOLS,那么我们需要在 .eslintrc.js 的 globals 对象中加入 TOOLS: true 解决
  2. 并非所有方法都测试过,如果遇到报错,请及时联系我

更新记录

2.7.0 1.优化里列表转树方法,保持原来的排序 2.org.get.OrgSelectAuto/getOrgSelect 新增maxLevel 组织层级过滤

2.6.5 修复dict.set.setDictList opts无效 2.6.4 修复DateUtil.isTimeBefore/isTimeAfter 缺少return 2.6.3 FunctionUtil.debounceFn解决作用域bug

2.6.2 1.org.del.delOrg 删除匹配异常 2.BaseUtil.isEmpty 完善判空

2.6.1 org.get.OrgSelectAuto 修复onChange报错

2.6.0 一、org get: 1.新增方法 OrgSelectAuto

(🌟推荐使用🌟)获取组织树选择
传入传出自动做处理
@example
const App =()=>{
 const [form] = Form.useForm()
 const handleOk = ({oid})=>{
   console.log(oid) // 1
 }
 const {OrgSelectAuto} = TOOLS.org.get
 return (
   <Form form={form} onFinish={handleOk} initialValues={{oid:1}}>
     <Form.Item name="oid">
      <OrgSelectAuto placeholder="JSX使用" />
     </Form.Item>
     <Form.Item name="niubi">
      {((Item) => <Item placeholder='函数使用' />)(TOOLS.org.get.OrgSelectAuto)}
     </Form.Item>
   </Form>
 )
}

2.getDownOrgList 新增参数 level

/**
 * 获取oid为1的部门下两级(包含本级)的树列表
 */
getDownOrgList({ type: 2, oid: 1, level: 2, isTree: true });

2.5.0

一、ArrayUtil updates: 1.arrayWeightRemoval 添加泛型 ; 添加参数 isSaveLast 默认 true ,true 返回重复最后一个对象,false 返回重复第一个对象 2.sum 解决精度问题 0.1+1.1 ===1.2000000000000002

二、BaseUtil updates: 1.修改所有校验方法校验,例子如下: const data: {a:1}|[{a:1}]| undefined if(BaseUtil.isArray(data)){ data[0] //[{ a: 1; }] } data[0] // {a:1}|[{a:1}]| undefined 对象可能为“未定义”

三、DateUtil updates: 1.函数名规范 getAllDateList-> getSectionDateList add: 1.getSectionMonthList 补全月份区间数组 2.getSectionYearList 补全年份区间数组

四、FunctionUtil updates: 1.debounceFn、throttleFn、once 添加泛型

五、NumberUtil add: 1.correctNumberInput 保留 n 位小数 2.floatAdd 解决两个数相加精度丢失问题 3.floatSub 解决两个数相减精度丢失问题 4.floatMul 解决两个数相乘精度丢失问题 5.floatDiv 解决两个数相除精度丢失问题

六、ObjectUtil updates: 1.deepClone 添加泛型