![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
underscore源码一天学一点 (已完结)
文章平均质量分 64
atrocitytheme
这个作者很懒,什么都没留下…
展开
-
underscore.js 0 -- 101行
先上代码:(function() { // Baseline setup // -------------- // Establish the root object, `window` (`self`) in the browser, `global` // on the server, or `this` in some virtual machines. We use `self`原创 2017-07-12 17:52:34 · 262 阅读 · 0 评论 -
underscore.js 剩余属性1-- template
// By default, Underscore uses ERB-style template delimiters, change the // following template settings to use alternative delimiters. _.templateSettings = { evaluate: /<%([\s\S]+?)%>/g, in原创 2017-07-28 19:56:09 · 290 阅读 · 0 评论 -
underscore.js 1105 -- 1288 行
// Internal pick helper function to determine if `obj` has key `key`. var keyInObj = function(value, key, obj) { return key in obj; }; // Return a copy of the object only containing the whitel原创 2017-07-27 22:26:39 · 203 阅读 · 0 评论 -
underscore.js 964 --- 1103行
今天剩下的大部分都是工具函数了,比较易读,就过一遍即可// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); var nonEnumerableProps原创 2017-07-26 22:47:02 · 198 阅读 · 0 评论 -
underscore.js 755 -- 876
// Function (ahem) Functions // ------------------ // Determines whether to execute a function as a constructor // or a normal function with the provided arguments. var executeBound = function(s原创 2017-07-19 18:48:19 · 232 阅读 · 0 评论 -
underscore.js 652 --- 748行
// Generator function to create the findIndex and findLastIndex functions. var createPredicateIndexFinder = function(dir) { return function(array, predicate, context) { predicate = cb(predi原创 2017-07-18 12:12:18 · 193 阅读 · 0 评论 -
underscore.js 530 -- 652行
// Internal implementation of a recursive `flatten` function. var flatten = function(input, shallow, strict, output) { output = output || []; var idx = output.length; for (var i = 0, leng原创 2017-07-17 16:42:34 · 231 阅读 · 0 评论 -
underscore.js 409 -- 526行
// Sort the object's values by a criterion produced by an iteratee. _.sortBy = function(obj, iteratee, context) { var index = 0; iteratee = cb(iteratee, context); return _.pluck(_.map(obj原创 2017-07-16 22:10:32 · 238 阅读 · 0 评论 -
underscore.js 882 -- 963
// Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed原创 2017-07-20 11:13:17 · 197 阅读 · 0 评论 -
underscore.js 293--409
// Invoke a method (with arguments) on every item in a collection. _.invoke = restArgs(function(obj, path, args) { var contextPath, func; if (_.isFunction(path)) { func = path; } el原创 2017-07-15 18:05:02 · 226 阅读 · 0 评论 -
underscore.js 170 -- 293 行
// The cornerstone, an `each` implementation, aka `forEach`. // Handles raw objects in addition to array-likes. Treats all // sparse array-likes as if they were dense. _.each = _.forEach = functi原创 2017-07-14 14:34:08 · 238 阅读 · 0 评论 -
underscore.js 102 -- 170行
// Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html) // This accumulates the arguments passed into an array, after a given index. var restArgs = function(fu原创 2017-07-13 23:30:45 · 564 阅读 · 0 评论 -
underscore.js 剩余部分2 --- 面向对象及链式调用
_.mixin // Add your own custom functions to the Underscore object. _.mixin = function(obj) { _.each(_.functions(obj), function(name) { var func = _[name] = obj[name]; _.prototype[name原创 2017-07-29 08:35:29 · 380 阅读 · 0 评论