1 Star 6 Fork 1

Chauncey-Yi/nodeTool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

nodeTool

github gitee

nodejs常用或常见工具类集合体,由于npm已经存在nodeTool的包,所以发布以y-node-tool包名命名

介绍

使用nodejs作为服务端开发时候一些经验总结 均采用原生js手撸(996当中摸鱼)

比如,我们在判断一个字符串是否为空值的时候

  • 我们需要判断字符是是否未定义undefined

  • 是否是null值

  • 是否是空字符串等

    let str=null;
    if(undefined === str || null === str || '' === str){
    	console.log('str is empty !');
    }

当我们使用封装的方法后,这些操作将会变得简单

const {StringUtil} = require('y-node-tool');

let str = null ;
if(StringUtil.isEmpty(str)){
   console.log('str is empty !');
}

工具类实现列表

  • StringUtil 字符串工具
  • MapUtil] map工具
  • BufferUtil buffer工具
  • DateUtil 日期工具
  • UUID UUID
  • Snowflake 推特雪花算法
  • ObjectUtil 对象工具
  • ArrayUtil array工具
  • PageUtil] 分页工具
  • RandomUtil 随机工具
  • PhoneUtil 手机号工具
  • RandomWeightUtil 随机权重工具
  • BufferUtil buffer工具
  • NetUtil 网络工具
  • IPV4Util ipv4工具
  • OSUtil] 系统操作工具(好像并不需要怎么封装呀)
  • ReUtil 正则工具(莫名发现好像js的正不是全匹配的不知道是不是姿势不太对)
  • StringFormatUtil 字符串格式化工具 (就是感觉没有就写一个)
  • ErrorUtil 错误工具
  • Base64 base64
  • UUIDUtil uuid工具类

API文档

一些方法的实现列表,使用jsdoc生成

Github Pages

如何使用

当然这里提供两种方案 :

  • 查看源码并且cv(cv大法,哈哈哈,没什么值得的)

  • 获取已经向npm发布的版本 :

    npm install y-node-tool
    const {StringUtil} = require('y-node-tool');
  • 好的,开始使用吧

用例

所有用例在源码 test 目录下可以找到

其他

MIT License Copyright (c) 2021 Chauncey-Yi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

摸鱼时候写的的nodeJS工具集合 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/yichengxian/nodeTool.git
git@gitee.com:yichengxian/nodeTool.git
yichengxian
nodeTool
nodeTool
main

搜索帮助

Cb406eda 1850385 E526c682 1850385