0.4.0 • Published 6 years ago

ccclodash v0.4.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

ccclodash

Reimplement some function of lodash, just a practice

Install

$ npm i ccclodash

Document

Example

File : ex1.js

const _ = require('ccclodash')

console.log("_.chunk(['a', 'b', 'c', 'd'], 2)=", _.chunk(['a', 'b', 'c', 'd'], 2))
console.log("_.chunk(['a', 'b', 'c', 'd'], 3)=", _.chunk(['a', 'b', 'c', 'd'], 3))

Run

$ node ex1.js
_.chunk(['a', 'b', 'c', 'd'], 2)= [ [ 'a', 'b' ], [ 'c', 'd' ] ]
_.chunk(['a', 'b', 'c', 'd'], 3)= [ [ 'a', 'b', 'c' ], [ 'd' ] ]

Test

$ mocha

  chunk
    √ _.chunk(['a', 'b', 'c', 'd'], 2) equalTo [ [ 'a', 'b' ], [ 'c', 'd' ] ] (52ms)
    √ _.chunk(['a', 'b', 'c', 'd'], 3) equalTo [ [ 'a', 'b', 'c' ], [ 'd' ] ]
    √ _.chunk(['a', 'b', 'c', 'd'], 3) notEqualTo [ [ 'a', 'b'], ['c' , 'd' ] ]

  compact
    √ _.compact([0, 1, false, 2, '', 3]) equalTo [ 1, 2, 3 ]

  concat
    √ _.concat(array, 2, [3], [[4]]) equalTo [1, 2, [3], [[4]]] (73ms)
    √ _.concat(array, 2, [3], [[4]]) equalTo [ 1, 2, 3 ]


  6 passing (175ms)
0.4.0

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago