Code Monkey home page Code Monkey logo

xijs's Introduction

xijs

一款面向复杂业务场景的 js 类库, 目前已支持:

  • parser json 解析器, 在原生 json api 基础上支持序列化和反序列化函数, 正则等
  • store 一款支持设置过期时间且支持回调的本地缓存库, 基于 localStorage 二次封装
  • formatDate 支持自定义的时间格式化函数
  • obj2url 将对象转换成编码后的 url 字符串
  • url2obj 将 url 字符串转换成对象
  • isPc 判断设备是否为 pc 端类型
  • debounce 防抖函数
  • throttle 节流函数
  • randomStr 生成指定个数随机字符串的函数
  • uuid 生成唯一 id

API Doc

xijs

parser

该 json 解析器基于原生JSON API进行的上层封装, 支持序列化函数类型

  • 支持原生 json api 调用方式nativeStringify, nativeParse
  • 支持序列化和反序列化函数 stringify, fastStringify, parse
  • 支持序列化和反序列化正则 stringify, fastStringify, parse
  • 内置开箱即用的工具方法
    • 判断函数类型 isFunc
    • 判断对象类型 isObj
    • 判断数组类型 isArr
    • 判断对象或数组类型 isArrOrObj
    • 判断正则类型 isRegExp

Demo:

/**
 * title: 打开控制台查看结果
 */
import { parser } from 'xijs';

const door = {
  a: 1,
  b: function () {},
  c: {
    c1: 'h5-dooring',
    c2: () => {},
    c3: {
      c: '3fvc',
      d: {
        dd: () => {},
        ee: /[a-z]/g,
      },
    },
  },
  d: /[0-9]/g,
};

// 将对象序列化
console.log('stringify', parser.stringify(door));
console.log('fastStringify', parser.fastStringify(door));

// 将json数据反解析成对象
console.log(parser.parse(parser.stringify(door)));

console.log('native stringify', parser.nativeStringify(door));

更多推荐

name Description
H5-Dooring 让 H5 制作像搭积木一样简单, 轻松搭建 H5 页面, H5 网站, PC 端网站, LowCode 平台.
V6.Dooring 可视化大屏解决方案, 提供一套可视化编辑引擎, 助力个人或企业轻松定制自己的可视化大屏应用.
dooring-electron-lowcode 基于 electron 的 H5-Dooring 编辑器桌面端.
DooringX 快速高效搭建可视化拖拽平台.

xijs's People

Contributors

aleryxu avatar mrxujiang 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.