2016-03-07から1日間の記事一覧

Underscore.jsおさらい6(Utility、Chaining)

noConflict _.noConflict() underscoreは「_」がデフォルトだが、他のライブラリで使っていると衝突するので衝突防止。 var underscore = _.noConflict(); identity _.identity(value) 引数自身を返す。f(x) = xの処理。underscoreのiterateeデフォルト判定…

Underscore.jsおさらい5(Objects)

keys _.keys(object) keyの一覧が配列で返る。 _.keys({one: 1, two: 2, three: 3}); => ["one", "two", "three"] allKeys _.allKeys(object) prototypeも含めて全キーが返る。 function Stooge(name) { this.name = name; } Stooge.prototype.silly = true;…