タグ

underscore.jsに関するYudoufuのブックマーク (4)

  • Underscore.js

    Table of Contents Collections each, map, inject, detect, select, reject, all, any, include, invoke, pluck, max, min, sortBy, sortedIndex, toArray, size Arrays first, last, compact, flatten, without, uniq, intersect, zip, indexOf Functions bind, bindAll, delay, defer, wrap Objects keys, values, extend, clone, isEqual, isElement, isArray, isFunction, isUndefined Utility uniqueId, template Collection

  • ryuone日記(2011-08-14)

    ■ [JavaScript] underscore.jsの実装について調べてみた。 underscore.jsのドキュメントを眺めてて、_.times(3, function(){})と_(3).times(function(){})が同じ動作をする理由を知りたくて、underscore.jsのprototypeまわり(wrapper)を調べたので、調べた内容を吐き出しておく。 処理の内容としては、_(3)とした場合、underscore.jsは、引数を各関数の第一引数に割り当てる。これは、addToWrapper関数内で行っている。 (function() { // Baseline setup // -------------- // Establish the root object, `window` in the browser, or `global` on the serve

    ryuone日記(2011-08-14)
  • Underscore.js - 4 Code Reading

    Underscore.js 1.1.6のソースコードを見ていく Table of Contentsによるとそれぞれジャンル分けされているので、それに沿って読む。 Collections Arrays Functions Objects Utility Chaining 最初の初期化とか、取り決めらへん グローバル変数 Underscore.jsはというグローバル変数のみを持っていて、以下に便利な関数を 詰め込んだ感じのライブラリです。 (function() { // Establish the root object, `window` in the browser, or `global` on the server. // rootになるオブジェクト、ブラウザだとwindowだけどunderscore.jsはブラウザ以外でも使えるのでthisでグローバルをとる var root =

  • 便利機能満載のライブラリUnderscore.js - PolyPeaceLight

    便利機能満載のライブラリUnderscore.js - にのせき日記が「力尽きた」と仰っているので勝手に続きを書く Object Functions tap _.tap(object, interceptor) chainを使うときに、途中にobjectを割り込ませ、chainの途中結果を知ることが第一義の目的。 _([1,2,3,200]).chain(). select(function(num) { return num % 2 == 0; }). tap(console.log). map(function(num) { return num * num }). value(); => [2, 200] => [4, 40000] isEqual _.isEqual(object, other) 2つのobjectをdeep compareすることが目的 var moe = {na

    便利機能満載のライブラリUnderscore.js - PolyPeaceLight
  • 1