underscore.js

underscore.jsで気になる関数(Functions、Objects、Utility、Chaining編)

前回の続きです。今日はUnderscore.jsのFunctions、Objectsを中心に見ていきます。 Functions FPぽいことするのに便利な関数が揃ってます。 _.memoize(function, [hashFunction]) メモ化関数です。関数の計算結果を記憶しておいて、再計算のコストを低くして…

underscore.jsで気になる関数(collections、arrays編)

2回目にして、もうネタ切れ気味になってきた新人のMです。 ネタ切れ気味なので、今日は軽めにUnderscore.jsで気に入ってる関数を幾つか紹介します。 Collections 一般的なmap・reduce・filter系ですが、jsのmap関数はArrayのメソッドだったりするので、Hash…