Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@moomfe/zenjs

MoomFE1.8kMIT5.0.0-beta.5TypeScript support: included

ZenJS 是一个高性能的 JavaScript 工具库。

zen, zenjs, javascript, utilities, util, prototype

readme

ZenJS

ZenJS 是一个高性能的 JavaScript 工具库。



浏览器支持

Chrome Firefox Safari Android Edge Internet Explorer
23+ 21+ 6+ 4.4+ 12+ 10+

安装

npm 安装

  npm install @moomfe/zenjs

CDN

jsdelivr
https://cdn.jsdelivr.net/npm/@moomfe/zenjs@5.0.0-beta.5/dist/

unpkg
https://unpkg.com/@moomfe/zenjs@5.0.0-beta.5/dist/


在 v2.1.0 版本之前, ZenJS 需要 polyfill 作为依赖项 :


大小 - 版本详解

Default

| | Default | Gzip | - | Module | Use in | | :- | :- | :- | :-: | :- | :- | | zen.js | 57.01kb | 15.94kb | | | UMD | Browser | | zen.min.js | 20.42kb | 7.69kb | | | UMD | Browser | | zen.common.js | 53.12kb | 15.65kb | | | CommonJS | NodeJS or browserify or webpack 1 | | zen.esm.js | 53.11kb | 15.63kb | | | ES Module | webpack 2 or rollup |

Fat : Default And DOM API

| | Default | Gzip | - | Module | Use in | | :- | :- | :- | :-: | :- | :- | | zen.fat.js | 101.99kb | 27.36kb | | | UMD | Browser | | zen.fat.min.js | 36.36kb | 13.44kb | | | UMD | Browser | | zen.fat.common.js | 95.27kb | 26.90kb | | | CommonJS | NodeJS or browserify or webpack 1 | | zen.fat.esm.js | 95.25kb | 26.89kb | | | ES Module | webpack 2 or rollup |


参考

更详细的使用方法及介绍请参照 index.d.ts

  • Array

    • $chunk
    • $copy
    • $create
    • $create
    • $each
    • $equals
    • $isArrayLike
    • $toArray
  • Array.prototype

    • $chunk
    • $each
    • $equals
    • $add
    • $delete / $remove
    • $deleteValue / $removeValue
    • $concat
    • $concatTo
    • $find
    • $findIndex
    • $findChunk
    • $findLast
    • $findLastIndex
    • $findLastChunk
    • $findAll
    • $findAllIndex
    • $findAllChunk
    • $findSome
    • $findSomeIndex
    • $findSomeChunk
    • $findLastSome
    • $findLastSomeIndex
    • $findLastSomeChunk
    • $findNot
    • $findNotIndex
    • $findNotChunk
    • $findLastNot
    • $findLastNotIndex
    • $findLastNotChunk
    • $findAllNot
    • $findAllNotIndex
    • $findAllNotChunk
    • $findSomeNot
    • $findSomeNotIndex
    • $findSomeNotChunk
    • $findLastSomeNot
    • $findLastSomeNotIndex
    • $findLastSomeNotChunk
    • $get
    • $set
    • $edit
    • $inArray
    • $move
    • $moveRange
    • $push
    • $pop
    • $unshift
    • $shift
    • $splice
  • Object

    • $assign
    • $equals
    • $each
    • $isEmptyObject
    • $isPlainObject
  • Object.prototype

    • $assign
    • $equals
    • $each
    • $get
    • $set / $edit
    • $delete / $remove
    • $deleteValue / $removeValue
    • $self
  • Number

    • $isNumber
  • Number.prototype

    • $add / $jia
    • $subtract / $jian
    • $multiply / $cheng
    • $divide / $chu
  • Math

    • $random
    • $add / $jia
    • $subtract / $jian
    • $multiply / $cheng
    • $divide / $chu
    • $mean
  • String

    • $random
    • $someRandom
  • String.prototype

    • $replaceAll
    • $toCapitalize / $toUpperFirstCase
    • $toLowerFirstCase
  • Date

    • $parse
    • $format
    • $year
    • $month
    • $date
    • $day
    • $hour
    • $minute
    • $second
    • $millisecond
    • $set
    • $add
    • $subtract
    • $startOf
    • $endOf
    • $diff
    • $valueOf
    • $unix
    • $daysInMonth
    • $toArray
    • $toObject
    • $isBefore
    • $isSame
    • $isAfter
    • $isBetween
    • $isSameOrBefore
    • $isSameOrAfter
    • $isLeapYear
  • Date.prototype

    • $dayjs
    • $isValid
    • $year
    • $month
    • $date
    • $day
    • $hour
    • $minute
    • $second
    • $millisecond
    • $set
    • $add
    • $subtract
    • $startOf
    • $endOf
    • $format
    • $diff
    • $valueOf
    • $unix
    • $daysInMonth
    • $toArray
    • $toObject
    • $isBefore
    • $isSame
    • $isAfter
    • $isBetween
    • $isSameOrBefore
    • $isSameOrAfter
    • $isLeapYear
  • Function.prototype

    • $after
    • $args
    • $one / $once
  • RegExp

    • $parse
  • Window / Global

    • $typeof
    • $querystring
      • stringify
      • parse
    • ZenJS
      • guid
      • assign
      • repeat
      • keys
      • entries
      • values
      • fromEntries
      • congruence
      • equals
      • define
      • defineValue
      • defineGet
      • intRandom
      • returnArg
      • returnTrue
      • returnFalse
      • noop
      • parametersDefault
      • parametersRest
      • isString
      • isBoolean
      • isArray
      • isNumber
      • isRegExp
      • isSet
      • isMap
      • isFunction
      • isObject
      • isReferenceType
      • mapSetToArray
    • dayjs
  • Document ( Fat )

    • $id
    • $ready
    • $query / $find
    • $queryFirst / $findFirst
  • Window ( Fat )

    • $ready
  • Location ( Fat )

    • $search
    • $urlSearch
  • Element.prototype ( Fat )

    • $addClass
    • $removeClass / $deleteClass
    • $hasClass
    • $toggleClass
    • $is
    • $not
    • $first / $firstChild
    • $last / $lastChild
    • $next
    • $prev
    • $nextAll
    • $prevAll
    • $child / $children
    • $parent
    • $parents
    • $siblings
    • $prop
    • $hasProp
    • $removeProp / $deleteProp
    • $attr
    • $hasAttr
    • $removeAttr / $deleteAttr
    • $append
    • $prepend
    • $appendTo
    • $prependTo
    • $before
    • $after
    • $delete / $remove
    • $query / $find
    • $queryFirst / $findFirst
    • $replaceWith / $replace
    • $clone
    • $index
    • $html
    • $val / $value
    • $width
    • $height
    • $css
    • _nodeName
  • EventTarget.prototype ( Fat )

    • $data
    • $hasData
    • $removeData/ $deleteData
    • $on
    • $one / $once
    • $off
    • $emit
  • document ( Plugins )

    • $cookie
    • $removeCookie / $deleteCookie

在本地构建ZenJS

克隆到本地:

git clone https://github.com/MoomFE/ZenJS.git

安装依赖项:

cd ZenJS && npm install

构建项目:

npm run build

实时监听项目修改:

npm run watch

Include


License

ZenJS is licensed under a MIT License.

changelog

1.7.8 (2018-12-13)

Feature

  • update isSame isBefore isAfter supports units (fd65464)

  • add greek lithuanian locales

1.7.7 (2018-09-26)

Bug Fixes

  • DST: fix daylight saving time DST bug && add test (#354) (6fca6d5)

1.7.6 (2018-09-25)

Bug Fixes

  • add dayjs.unix: add dayjs.unix to parse timestamp in seconds && locale update (5711c5e)

1.7.5 (2018-08-10)

Bug Fixes

  • add isBetween API & update (b5fc3d1)

1.7.4 (2018-07-11)

Bug Fixes

1.7.3 (2018-07-10)

Bug Fixes

  • locale-nl: set correct weekdays and months (6d089d7)

1.7.2 (2018-07-04)

Bug Fixes

  • DEPRECATED isLeapYear, use IsLeapYear plugin instead (e2e5116)

1.7.1 (2018-07-03)

Bug Fixes

  • fix week() error near the end of the year (fa03689)

1.7.0 (2018-07-02)

Features

  • Added method .week() to retrieve week of the year (e1c1b1c)
  • Updated Japanese locae

1.6.10 (2018-06-25)

Bug Fixes

  • Add relative locales to russian language (c7e9898), closes #256

1.6.9 (2018-06-14)

Bug Fixes

  • add isDayjs => boolean API (6227c8b)

1.6.8 (2018-06-14)

Bug Fixes

  • fix Advanced format bug in zh-cn (0c07874), closes #242

1.6.7 (2018-06-11)

Bug Fixes

1.6.6 (2018-06-06)

Bug Fixes

  • format API update and locale file update (5ca48f0), closes #228

1.6.5 (2018-05-31)

Bug Fixes

  • bugfix, utils update and locale file update (ebcb6d5), closes #214

1.6.4 (2018-05-25)

Bug Fixes

  • add RelativeTime plugin and locale file update (c1fbbca), closes #198

1.6.3 (2018-05-21)

Bug Fixes

  • Changing locales locally is immutable from this release (2cce729), closes #182
  • instance locale change should be immutable (84597c9)
  • Add more locales
  • english ordinal fix

1.6.2 (2018-05-18)

Bug Fixes

  • change-log update && test new npm release (aa49cba), closes #163

1.6.1 (2018-05-18)

Bug Fixes

  • Add German, Brazilian Portuguese locales
  • add() & parse() bug fix & add locale de, pt-br (bf1331e)

1.6.0 (2018-05-15)

Features