ccclodash
v0.4.0
Published
Reimplement some function of lodash
Downloads
3
Readme
ccclodash
Reimplement some function of lodash, just a practice
Install
$ npm i ccclodash
Document
- https://rawgit.com/se107a/ccclodash/master/docs/-_.html
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)