GithubHelp home page GithubHelp logo

len-utils's Introduction

len-utils

前端工具类

cookie/sessionStorage/localStorage设置、获取、清除

  • setStorage(key, data);
  • getStorage(key);
  • rmStorage(key);
  • setStorage(key, data, 'localStorage');
  • getStorage(key, 'localStorage');
  • rmStorage(key, 'localStorage');
  • setCookie(key, data, days);
  • getCookie(key);
  • rmCookie(key);

例子:

import lenUtils from 'len-utils';
lenUtils.getStorage('userInfo');

获取url参数

例子:

# http://www.lengziyu.cn?id=1

let id = lenUtils.getUrlQuery('id');
console.log(id); // 1

判断是移动端/PC端,移动端区分ios、安卓

例子:

let get = lenUtils.getOS();
console.log(isIos);

数组常见处理

常见的正则验证

日期处理

获取浏览器相关

[]数组的打印

字符串常见处理

搜索结果标红

防抖和节流

len-utils's People

Contributors

lengziyu avatar

Watchers

 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.