Coder Social home page Coder Social logo

tool-kit's Introduction

formatDate

日期时间格式化

参数

  • @param1 <string | number> time
  • @param2 type

示例,用符号占位,可以任意组合
# const time = '2022-1-1 10:11:12'; #
# formatDate(time, 'yyyy年MM月dd日 hh时mm分ss秒'); // 2022年01月01号 10时11分12秒 #

符号    |   名称
----    |   ----
yyyy    |   年
MM      |   月
dd      |   日
hh      |   小时
mm      |   分钟
ss      |   秒

encrypt

加密

参数

  • @param1 data

示例
# const target = '5863538192fa472b9090161b974823bc'; #
# const result = encrypt(target); // 5E6N5N8L9Of�4J2�9M9M1K1�9J4E2Nb� #

decrypt

解密

参数

  • @param1 data

示例
# decrypt(result); // 5863538192fa472b9090161b974823bc #

arrRepeat

数组去重

参数

  • @param1 arr
  • @param2 <...args> args 可变参数

示例
# const arr = [{id:1,name:11},{id:2,name:11},{id:1,name:22},{id:1,name:22}]; #
# arrRepeat(arr, 'id'); // [{id:1,name:11},{id:2,name:11}] #
# arrRepeat(arr, 'name'); // [{id:1,name:11},{id:1,name:22}] #
# arrRepeat(arr, 'id', 'name'); // [{id:1,name:11},{id:2,name:11},{id:1,name:22}] #

arrDelayer

树形结构扁平化

参数

  • @param1 arr

示例
# const tree = [{id:'1',children:[{id:'1-1'},{id:'1-2'}]}]; #
# arrDelayer(tree, 'id'); // [{id:'1'},{id:'1-1'},{id:'1-2'}]; #

deepCopy

深复制

参数

  • @param1 json

    示例
    # const copy = {id:'1',colors:{red:1}}; #
    # deepCopy(copy); // {id:'1',colors:{red:1}} #

    jsonToStr

    json转字符串

    参数

    • @param1 json

      示例
      # jsonToStr({id: 1,name: 2}); // id=1&name=2 #

      strToJson

      字符串转json

      参数

      • @param1 str

      示例
      # strToJson('id=1&name=2'); // {id: 1,name: 2} #

tool-kit's People

Stargazers

wanghuajuan avatar

Watchers

wanghuajuan 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.