Giter Site home page Giter Site logo

kingzlz / frontoutils Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 80 KB

整理一些前端开发常用到的操作字符串,对象,数组,日期,正则等等常用的方法.供大家直接使用

Home Page: https://www.npmjs.com/package/frontoutils

License: Apache License 2.0

HTML 2.08% JavaScript 97.92%

frontoutils's Introduction

frontoutils

前端开发业务常用代码工具库

目的:高效率完成前端业务代码

在前端业务开发过程中,会经常要对数组,对象,字符串,日期等进行操作,为了方便整理了一些类似日期格式化url参数转对象浏览器类型判断节流函数等常用函数,为避免不同项目多次复制粘贴的麻烦,这里统一封装,并发布到npm,以提高开发效率。如果你也有常用的代码,欢迎为本项目提交pr。

安装使用

  1. 直接下载dist目录下的[frontoutils.min.js]使用,支持UMD通用模块规范
  2. 使用npm安装

浏览器:

  <script src="frontoutils.min.js"></script>
  <script>
    // 想用哪个工具,直接定义
    var stringTool = frontoutils.stringTool;
    var utils = frontoutils.utils;

    console.log(utils.uuid());

  </script>

npm:

$ npm install --save-dev frontoutils

推荐使用方法

在项目中可直接import or require

// import  or  require
import frontoutils from 'frontoutils';

console.log(frontoutils.utils.uuid());
或者
const xxxxTool = require('frontoutils').xxxxTool

const utils = require('frontoutils').utils
console.log(utils.uuid());

API文档

Array

[arrayEqual]判断两个数组是否相等

Cookie

[getCookie]根据name读取Cookie

[removeCookie]根据name删除Cookie

[setCookie]添加Cookie

通用工具

[debounce]函数防抖

[throttle]函数节流

[getKeyName]根据keycode获得键名

Regexp

[isEmail]判断是否为邮箱地址

[isIdCard]判断是否为身份证号

[isPhoneNum]判断是否为手机号

[isUrl]判断是否为URL地址

String

[digitUppercase]现金额转大写

Date

Url

详情请到src里面看各种方法

frontoutils's People

Contributors

kingzlz avatar

Stargazers

ericzhao avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.