New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

zan-utils

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zan-utils

通用工具库

  • 1.2.14
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
20
decreased by-31.03%
Maintainers
1
Weekly downloads
 
Created
Source

zan-utils

utils的定位是一个共用函数库,提取出大部分业务需要的共用的函数。

安装
npm install --save zan-utils
使用

使用方法类似于lodash,需要使用哪个函数,只引用当前函数。

// ES6
import formatDate from 'zan-utils/date/formatDate';

对于ES5,需要全部引入:

// ES5
var dateFormat = require('zan-utils/dist/main').date.makeDateStr;
模块

目前有6个模块:

  1. browser与浏览器相关的函数
  2. date与日期相关的函数
  3. money与金钱相关的函数
  4. string与字符串相关的函数
  5. url与URL相关的函数
  6. validate与校验相关的函数
  7. number与数字计算相关的函数

还有几个特殊的函数:

  • fullfillImage: 补全图片 url
  • jquery: 剔除ajax并且不在全局对象挂载$

如果需要其他的函数,请联系wulv@youzan.com添加,最好可以直接提PR。

开发者

./utils
├── __tests__  // 测试代码
├── dist       // 打包合并后代码
├── docs       // 文档
├── lib        // 打包后代码
├── scripts    // 脚本
├── src        // 开发目录
├── typings   // dts定义目录
  1. 开发:在src目录下一个函数作为一个文件的方式开发,使用ES6
  2. 测试:在__tests__目录添加测试文件,测试使用jest框架,使用zent-kit。直接执行npm run test --watch,如果只对某一个文件监听改动只要:npm run test -- __tests__/date.js --watch
  3. typings目录添加dts模块定义,让编辑器提示参数返回值
  4. 文档:执行gulp watch就可以监听文件改动自动刷新文件页面,部署通过gulp deploy命令。
  5. 注释:文档是通过jsdoc从注释自动生成的,注释需要按照jsdoc的规范写,可以使用markdown

FAQs

Package last updated on 13 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc