underscore

Author Avatar
Aryb1n 10月 09, 2016

Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects.

node 里 这样 用就行啦

//example.js
var _ = require('../underscore');
function unsplat(fun) {
  return function() {
    return fun.call(null, _.toArray(arguments));
  };
}
var joinElement = unsplat(function(array) {return array.join(' ')});

var res = joinElement(1, 2);
console.log(res);
//=>"1 2"