From 63a1c8b63e7985215e58f27a0143cf688069ea79 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 3 Jul 2013 23:14:06 -0700 Subject: [PATCH] Update vendors, builds, and docs. Former-commit-id: 08cad493d719ec3ebaa85e0ff279c49f1e2b3655 --- dist/lodash.compat.js | 17 +- dist/lodash.compat.min.js | 4 +- dist/lodash.js | 17 +- dist/lodash.min.js | 4 +- doc/README.md | 250 ++-- vendor/backbone/README.md | 26 - vendor/benchmark.js/README.md | 128 -- vendor/curl/LICENSE.txt | 24 + vendor/curl/src/curl.js | 1323 +++++++++++++++++++++ vendor/docdown/README.md | 35 - vendor/dojo/LICENSE | 195 ++++ vendor/dojo/dojo.js | 1997 ++++++++++++++++++++++++++++++++ vendor/jquery/README.md | 417 ------- vendor/json3/LICENSE | 4 +- vendor/json3/README.md | 124 -- vendor/json3/lib/json3.js | 541 +++++---- vendor/platform.js/README.md | 100 -- vendor/platform.js/platform.js | 14 +- vendor/qunit-clib/README.md | 60 - vendor/qunit/MIT-LICENSE.txt | 21 + vendor/qunit/README.md | 62 - vendor/qunit/qunit/qunit.css | 2 +- vendor/qunit/qunit/qunit.js | 262 +++-- vendor/requirejs/README.md | 51 - vendor/underscore/README.md | 19 - 25 files changed, 4175 insertions(+), 1522 deletions(-) delete mode 100644 vendor/backbone/README.md delete mode 100644 vendor/benchmark.js/README.md create mode 100644 vendor/curl/LICENSE.txt create mode 100644 vendor/curl/src/curl.js delete mode 100644 vendor/docdown/README.md create mode 100644 vendor/dojo/LICENSE create mode 100644 vendor/dojo/dojo.js delete mode 100644 vendor/jquery/README.md delete mode 100644 vendor/json3/README.md delete mode 100644 vendor/platform.js/README.md delete mode 100644 vendor/qunit-clib/README.md create mode 100644 vendor/qunit/MIT-LICENSE.txt delete mode 100644 vendor/qunit/README.md delete mode 100644 vendor/requirejs/README.md delete mode 100644 vendor/underscore/README.md diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index ee070a62a..e157185d1 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -221,9 +221,7 @@ typeCache = cache[type] || (cache[type] = {}); if (type == 'object') { - if ((typeCache[key] || (typeCache[key] = [])).push(value) == this.array.length) { - cache[type] = false; - } + (typeCache[key] || (typeCache[key] = [])).push(value); } else { typeCache[key] = true; } @@ -280,8 +278,13 @@ */ function createCache(array) { var index = -1, - length = array.length; + length = array.length, + first = array[0], + last = array[length - 1]; + if (first && typeof first == 'object' && last && typeof last == 'object') { + return false; + } var cache = getObject(); cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; @@ -293,9 +296,7 @@ while (++index < length) { result.push(array[index]); } - return cache.object === false - ? (releaseObject(result), null) - : result; + return result; } /** @@ -5501,7 +5502,7 @@ // avoid issues with Narwhal, IE conditional compilation, and the JS engine // embedded in Adobe products. // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - var sourceURL = '\n/*\n//@ sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; + var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; try { var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index a5863d85b..30f62f809 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,8 +4,8 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nt||typeof n=="undefined")return 1;if(nr?0:r);++ek;k++)u+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(u+="||(!v[m]&&r[m]!==y[m])"),u+="){"+n.f+"}"; diff --git a/dist/lodash.js b/dist/lodash.js index 4a74f14b6..ca1990083 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -214,9 +214,7 @@ typeCache = cache[type] || (cache[type] = {}); if (type == 'object') { - if ((typeCache[key] || (typeCache[key] = [])).push(value) == this.array.length) { - cache[type] = false; - } + (typeCache[key] || (typeCache[key] = [])).push(value); } else { typeCache[key] = true; } @@ -273,8 +271,13 @@ */ function createCache(array) { var index = -1, - length = array.length; + length = array.length, + first = array[0], + last = array[length - 1]; + if (first && typeof first == 'object' && last && typeof last == 'object') { + return false; + } var cache = getObject(); cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; @@ -286,9 +289,7 @@ while (++index < length) { result.push(array[index]); } - return cache.object === false - ? (releaseObject(result), null) - : result; + return result; } /** @@ -5162,7 +5163,7 @@ // avoid issues with Narwhal, IE conditional compilation, and the JS engine // embedded in Adobe products. // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - var sourceURL = '\n/*\n//@ sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; + var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/'; try { var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues); diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 9649150b4..3a8683fbd 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,8 +4,8 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n,t,e){e=(e||0)-1;for(var r=n.length;++et||typeof n=="undefined")return 1;if(nt||typeof n=="undefined")return 1;if(ne?0:e);++r ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3640 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3641 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -242,7 +242,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3670 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3671 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -267,7 +267,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3720 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3721 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -295,7 +295,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3790 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3791 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -355,7 +355,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3852 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3853 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -398,7 +398,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3896 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3897 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -430,7 +430,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3963 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3964 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -487,7 +487,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3997 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3998 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -511,7 +511,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4099 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4100 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -568,7 +568,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4140 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4141 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -597,7 +597,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4181 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4182 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -635,7 +635,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4260 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4261 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -695,7 +695,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4324 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4325 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -744,7 +744,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4356 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4357 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -768,7 +768,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4406 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4407 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -815,7 +815,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4462 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4463 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -839,7 +839,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4488 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4489 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -864,7 +864,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4508 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4509 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -888,7 +888,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4530 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4531 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -923,7 +923,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L617 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L618 "View in source") [Ⓣ][1] Creates a `lodash` object, which wraps the given `value`, to enable method chaining. @@ -979,7 +979,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5639 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5640 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1009,7 +1009,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5656 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5657 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1030,7 +1030,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5673 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5674 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1061,7 +1061,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2627 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2628 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1089,7 +1089,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2669 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2670 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1127,7 +1127,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2724 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2725 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1163,7 +1163,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2776 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2777 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1209,7 +1209,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2837 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2838 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1255,7 +1255,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2904 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2905 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1304,7 +1304,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2951 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2952 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1336,7 +1336,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3001 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3002 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1373,7 +1373,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3034 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3035 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1402,7 +1402,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3086 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3087 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1447,7 +1447,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3143 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3144 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1489,7 +1489,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3212 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3213 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1531,7 +1531,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3262 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3263 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1561,7 +1561,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3294 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3295 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1599,7 +1599,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3337 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3338 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1630,7 +1630,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3397 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3398 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1673,7 +1673,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3418 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3419 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1697,7 +1697,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3451 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3452 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1727,7 +1727,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3498 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3499 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1773,7 +1773,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3554 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3555 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1810,7 +1810,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3590 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3591 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1834,7 +1834,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3622 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3623 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1871,7 +1871,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4570 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4571 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1899,7 +1899,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4603 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4604 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1930,7 +1930,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4634 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4635 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1961,7 +1961,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4680 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4681 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2002,7 +2002,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4703 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4704 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2029,7 +2029,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4762 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4763 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2083,7 +2083,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4847 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4848 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2124,7 +2124,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4944 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4945 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2149,7 +2149,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4970 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4971 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2176,7 +2176,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4995 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4996 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2202,7 +2202,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5025 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5026 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2228,7 +2228,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5060 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5061 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2255,7 +2255,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5091 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5092 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2292,7 +2292,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5126 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5127 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2326,7 +2326,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5167 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5168 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2362,7 +2362,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1365 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1366 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2400,7 +2400,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1420 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1421 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2447,7 +2447,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1550 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1551 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2493,7 +2493,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1574 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1575 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2519,7 +2519,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1596 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1597 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2547,7 +2547,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1637 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1638 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2583,7 +2583,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1662 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1663 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2611,7 +2611,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1679 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1680 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2638,7 +2638,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1704 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1705 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2663,7 +2663,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1721 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1722 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2687,7 +2687,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1228 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1229 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2714,7 +2714,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1254 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1255 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2741,7 +2741,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1747 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1748 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2765,7 +2765,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1764 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1765 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2789,7 +2789,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1781 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1782 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2813,7 +2813,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1806 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1807 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2843,7 +2843,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1865 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1866 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2888,7 +2888,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2051 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2052 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2926,7 +2926,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2068 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2069 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2950,7 +2950,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2131 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2132 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2985,7 +2985,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2153 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2154 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3012,7 +3012,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2170 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2171 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3036,7 +3036,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2098 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2099 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3066,7 +3066,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2198 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2199 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3101,7 +3101,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2223 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2224 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3125,7 +3125,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2240 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2241 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3149,7 +3149,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2257 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2258 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3173,7 +3173,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1287 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1288 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3197,7 +3197,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2316 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2317 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3253,7 +3253,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2431 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2432 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3284,7 +3284,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2466 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2467 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3308,7 +3308,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2504 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2505 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3339,7 +3339,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2559 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2560 "View in source") [Ⓣ][1] An alternative to `_.reduce`, this method transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3376,7 +3376,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2592 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2593 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3407,7 +3407,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5191 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5192 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3431,7 +3431,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5209 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5210 "View in source") [Ⓣ][1] This method returns the first argument passed to it. @@ -3456,7 +3456,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5235 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5236 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3486,7 +3486,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5264 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5265 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3506,7 +3506,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5288 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5289 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3533,7 +3533,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5311 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5312 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3561,7 +3561,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5355 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5356 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3596,7 +3596,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L450 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L451 "View in source") [Ⓣ][1] Create a new `lodash` function using the given `context` object. @@ -3614,7 +3614,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5439 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5440 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3696,7 +3696,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5564 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5565 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3728,7 +3728,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5591 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5592 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3752,7 +3752,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5611 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5612 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3786,7 +3786,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L826 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L827 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3805,7 +3805,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5854 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5855 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3817,7 +3817,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L644 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L645 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3829,7 +3829,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L669 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L670 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3841,7 +3841,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L661 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L662 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3853,7 +3853,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L678 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L679 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -3865,7 +3865,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L691 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L692 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3879,7 +3879,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L699 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L700 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3891,7 +3891,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L716 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L717 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3903,7 +3903,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L727 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L728 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3917,7 +3917,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L707 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L708 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3929,7 +3929,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L741 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L742 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3943,7 +3943,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L752 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L753 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3957,7 +3957,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L778 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L779 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3969,7 +3969,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L786 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L787 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3981,7 +3981,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L794 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L795 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3993,7 +3993,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L802 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L803 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -4005,7 +4005,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L810 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L811 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -4017,7 +4017,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L818 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L819 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. diff --git a/vendor/backbone/README.md b/vendor/backbone/README.md deleted file mode 100644 index 75aa0780c..000000000 --- a/vendor/backbone/README.md +++ /dev/null @@ -1,26 +0,0 @@ - ____ __ __ - /\ _`\ /\ \ /\ \ __ - \ \ \ \ \ __ ___\ \ \/'\\ \ \____ ___ ___ __ /\_\ ____ - \ \ _ <' /'__`\ /'___\ \ , < \ \ '__`\ / __`\ /' _ `\ /'__`\ \/\ \ /',__\ - \ \ \ \ \/\ \ \.\_/\ \__/\ \ \\`\\ \ \ \ \/\ \ \ \/\ \/\ \/\ __/ __ \ \ \/\__, `\ - \ \____/\ \__/.\_\ \____\\ \_\ \_\ \_,__/\ \____/\ \_\ \_\ \____\/\_\_\ \ \/\____/ - \/___/ \/__/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/_/\/_/\/____/\/_/\ \_\ \/___/ - \ \____/ - \/___/ - (_'_______________________________________________________________________________'_) - (_.———————————————————————————————————————————————————————————————————————————————._) - - -Backbone supplies structure to JavaScript-heavy applications by providing models key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface. - -For Docs, License, Tests, pre-packed downloads, and everything else, really, see: -http://backbonejs.org - -To suggest a feature, report a bug, or general discussion: -http://github.com/documentcloud/backbone/issues/ - -All contributors are listed here: -http://github.com/documentcloud/backbone/contributors - -Special thanks to Robert Kieffer for the original philosophy behind Backbone. -http://github.com/broofa diff --git a/vendor/benchmark.js/README.md b/vendor/benchmark.js/README.md deleted file mode 100644 index 488cbc1a0..000000000 --- a/vendor/benchmark.js/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# Benchmark.js v1.0.0 -[![build status](https://secure.travis-ci.org/bestiejs/benchmark.js.png)](http://travis-ci.org/bestiejs/benchmark.js) - -A [robust](http://calendar.perfplanet.com/2010/bulletproof-javascript-benchmarks/ "Bulletproof JavaScript benchmarks") benchmarking library that works on nearly all JavaScript platforms1, supports high-resolution timers, and returns statistically significant results. As seen on [jsPerf](http://jsperf.com/). - -## Download - - * [Development source](https://raw.github.com/bestiejs/benchmark.js/v1.0.0/benchmark.js) - -## Dive in - -We’ve got [API docs](http://benchmarkjs.com/docs) and [unit tests](http://benchmarkjs.com/tests). - -For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/benchmark.js/wiki/Roadmap). - -## Support - -Benchmark.js has been tested in at least Chrome 5~27, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. - -## Installation and usage - -Benchmark.js’ only hard dependency is [Lo-Dash](http://lodash.com/). - -In a browser: - -```html - - -``` - -Optionally, expose Java’s nanosecond timer by adding the `nano` applet to the ``: - -```html - -``` - -Or enable Chrome’s microsecond timer by using the [command line switch](http://peter.sh/experiments/chromium-command-line-switches/#enable-benchmarking): - - --enable-benchmarking - -Via [npm](http://npmjs.org/): - -```bash -npm install benchmark -``` - -In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/): - -```js -var Benchmark = require('benchmark'); -``` - -Optionally, use the [microtime module](https://github.com/wadey/node-microtime) by Wade Simmons: - -```bash -npm install microtime -``` - -In [RingoJS v0.7.0-](http://ringojs.org/): - -```js -var Benchmark = require('benchmark').Benchmark; -``` - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('benchmark.js'); -``` - -In an AMD loader like [RequireJS](http://requirejs.org/): - -```js -require({ - 'paths': { - 'benchmark': 'path/to/benchmark', - 'lodash': 'path/to/lodash', - 'platform': 'path/to/platform' - } -}, -['benchmark'], function(Benchmark) { - console.log(Benchmark.platform.name); -}); -``` - -Usage example: - -```js -var suite = new Benchmark.Suite; - -// add tests -suite.add('RegExp#test', function() { - /o/.test('Hello World!'); -}) -.add('String#indexOf', function() { - 'Hello World!'.indexOf('o') > -1; -}) -// add listeners -.on('cycle', function(event) { - console.log(String(event.target)); -}) -.on('complete', function() { - console.log('Fastest is ' + this.filter('fastest').pluck('name')); -}) -// run async -.run({ 'async': true }); - -// logs: -// > RegExp#test x 4,161,532 +-0.99% (59 cycles) -// > String#indexOf x 6,139,623 +-1.00% (131 cycles) -// > Fastest is String#indexOf -``` - -## BestieJS - -Benchmark.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation. - -## Authors - -| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---|---| -| [Mathias Bynens](http://mathiasbynens.be/) | [John-David Dalton](http://allyoucanleet.com/) | - -## Contributors - -| [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | -|---| -| [Kit Cambridge](http://kitcambridge.github.io/) | diff --git a/vendor/curl/LICENSE.txt b/vendor/curl/LICENSE.txt new file mode 100644 index 000000000..1755b7a8e --- /dev/null +++ b/vendor/curl/LICENSE.txt @@ -0,0 +1,24 @@ +Open Source Initiative OSI - The MIT License + +http://www.opensource.org/licenses/mit-license.php + +Copyright (c) 2010-2013 Brian Cavalier and John Hann + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/curl/src/curl.js b/vendor/curl/src/curl.js new file mode 100644 index 000000000..2c1c08426 --- /dev/null +++ b/vendor/curl/src/curl.js @@ -0,0 +1,1323 @@ +/** @license MIT License (c) copyright 2010-2013 B Cavalier & J Hann */ + +/** + * curl (cujo resource loader) + * An AMD-compliant javascript module and resource loader + * + * curl is part of the cujo.js family of libraries (http://cujojs.com/) + * + * Licensed under the MIT License at: + * http://www.opensource.org/licenses/mit-license.php + * + */ +(function (global) { +//"use strict"; don't restore this until the config routine is refactored + var + version = '0.7.4', + curlName = 'curl', + defineName = 'define', + runModuleAttr = 'data-curl-run', + userCfg, + prevCurl, + prevDefine, + doc = global.document, + head = doc && (doc['head'] || doc.getElementsByTagName('head')[0]), + // to keep IE from crying, we need to put scripts before any + // elements, but after any . this should do it: + insertBeforeEl = head && head.getElementsByTagName('base')[0] || null, + // constants / flags + msgUsingExports = {}, + msgFactoryExecuted = {}, + // this is the list of scripts that IE is loading. one of these will + // be the "interactive" script. too bad IE doesn't send a readystatechange + // event to tell us exactly which one. + activeScripts = {}, + // readyStates for IE6-9 + readyStates = 'addEventListener' in global ? {} : { 'loaded': 1, 'complete': 1 }, + // these are always handy :) + cleanPrototype = {}, + toString = cleanPrototype.toString, + undef, + // local cache of resource definitions (lightweight promises) + cache = {}, + // local url cache + urlCache = {}, + // preload are files that must be loaded before any others + preload = false, + // net to catch anonymous define calls' arguments (non-IE browsers) + argsNet, + // RegExp's used later, pre-compiled here + dontAddExtRx = /\?|\.js\b/, + absUrlRx = /^\/|^[^:]+:\/\//, + findDotsRx = /(\.)(\.?)(?:$|\/([^\.\/]+.*)?)/g, + removeCommentsRx = /\/\*[\s\S]*?\*\/|\/\/.*?[\n\r]/g, + findRValueRequiresRx = /require\s*\(\s*(["'])(.*?[^\\])\1\s*\)|[^\\]?(["'])/g, + splitMainDirectives = /\s*,\s*/, + cjsGetters, + core; + + function noop () {} + + function isType (obj, type) { + return toString.call(obj).indexOf('[object ' + type) == 0; + } + + function normalizePkgDescriptor (descriptor) { + var main; + + descriptor.path = removeEndSlash(descriptor['path'] || descriptor['location'] || ''); + main = descriptor['main'] || './main'; + if (!isRelUrl(main)) main = './' + main; + // trailing slashes trick reduceLeadingDots to see them as base ids + descriptor.main = reduceLeadingDots(main, descriptor.name + '/'); + //if (isRelUrl(descriptor.main)) throw new Error('invalid main (' + main + ') in ' + descriptor.name); + descriptor.config = descriptor['config']; + + return descriptor; + } + + function isRelUrl (it) { + return it.charAt(0) == '.'; + } + + function isAbsUrl (it) { + return absUrlRx.test(it); + } + + function joinPath (path, file) { + return removeEndSlash(path) + '/' + file; + } + + function removeEndSlash (path) { + return path && path.charAt(path.length - 1) == '/' ? path.substr(0, path.length - 1) : path; + } + + function reduceLeadingDots (childId, baseId) { + // this algorithm is similar to dojo's compactPath, which interprets + // module ids of "." and ".." as meaning "grab the module whose name is + // the same as my folder or parent folder". These special module ids + // are not included in the AMD spec but seem to work in node.js, too. + var removeLevels, normId, levels, isRelative, diff; + + removeLevels = 1; + normId = childId; + + // remove leading dots and count levels + if (isRelUrl(normId)) { + isRelative = true; + normId = normId.replace(findDotsRx, function (m, dot, doubleDot, remainder) { + if (doubleDot) removeLevels++; + return remainder || ''; + }); + } + + if (isRelative) { + levels = baseId.split('/'); + diff = levels.length - removeLevels; + if (diff < 0) { + // this is an attempt to navigate above parent module. + // maybe dev wants a url or something. punt and return url; + return childId; + } + levels.splice(diff, removeLevels); + // normId || [] prevents concat from adding extra "/" when + // normId is reduced to a blank string + return levels.concat(normId || []).join('/'); + } + else { + return normId; + } + } + + function pluginParts (id) { + var delPos = id.indexOf('!'); + return { + resourceId: id.substr(delPos + 1), + // resourceId can be zero length + pluginId: delPos >= 0 && id.substr(0, delPos) + }; + } + + function Begetter () {} + + function beget (parent, mixin) { + Begetter.prototype = parent || cleanPrototype; + var child = new Begetter(); + Begetter.prototype = cleanPrototype; + for (var p in mixin) child[p] = mixin[p]; + return child; + } + + function Promise () { + + var self, thens, complete; + + self = this; + thens = []; + + function then (resolved, rejected, progressed) { + // capture calls to callbacks + thens.push([resolved, rejected, progressed]); + } + + function notify (which, arg) { + // complete all callbacks + var aThen, cb, i = 0; + while ((aThen = thens[i++])) { + cb = aThen[which]; + if (cb) cb(arg); + } + } + + complete = function promiseComplete (success, arg) { + // switch over to sync then() + then = success ? + function (resolved, rejected) { resolved && resolved(arg); } : + function (resolved, rejected) { rejected && rejected(arg); }; + // we no longer throw during multiple calls to resolve or reject + // since we don't really provide useful information anyways. + complete = noop; + // complete all callbacks + notify(success ? 0 : 1, arg); + // no more notifications + notify = noop; + // release memory + thens = undef; + }; + + this.then = function (resolved, rejected, progressed) { + then(resolved, rejected, progressed); + return self; + }; + this.resolve = function (val) { + self.resolved = val; + complete(true, val); + }; + this.reject = function (ex) { + self.rejected = ex; + complete(false, ex); + }; + this.progress = function (msg) { + notify(2, msg); + } + + } + + function isPromise (o) { + return o instanceof Promise || o instanceof CurlApi; + } + + function when (promiseOrValue, callback, errback, progback) { + // we can't just sniff for then(). if we do, resources that have a + // then() method will make dependencies wait! + if (isPromise(promiseOrValue)) { + return promiseOrValue.then(callback, errback, progback); + } + else { + return callback(promiseOrValue); + } + } + + /** + * Returns a function that when executed, executes a lambda function, + * but only executes it the number of times stated by howMany. + * When done executing, it executes the completed function. Each callback + * function receives the same parameters that are supplied to the + * returned function each time it executes. In other words, they + * are passed through. + * @private + * @param howMany {Number} must be greater than zero + * @param lambda {Function} executed each time + * @param completed {Function} only executes once when the counter + * reaches zero + * @returns {Function} + */ + function countdown (howMany, lambda, completed) { + var result; + return function () { + if (--howMany >= 0 && lambda) result = lambda.apply(undef, arguments); + // we want ==, not <=, since some callers expect call-once functionality + if (howMany == 0 && completed) completed(result); + return result; + } + } + + core = { + + /** + * * reduceLeadingDots of id against parentId + * - if there are too many dots (path goes beyond parent), it's a url + * - return reduceLeadingDots of id against baseUrl + parentId; + * * if id is a url (starts with dots or slash or protocol) + * - pathInfo = { config: userCfg, url: url } + * * if not a url, id-to-id transform here. + * - main module expansion + * - plugin prefix expansion + * - coordinate main module expansion with plugin expansion + * - main module expansion happens first + * - future: other transforms? + * @param id + * @param parentId + * @param cfg + * @return {*} + */ + toAbsId: function (id, parentId, cfg) { + var absId, pluginId, parts; + + absId = reduceLeadingDots(id, parentId); + + // if this is still a relative path, it must be a url + // so just punt, otherwise... + if (isRelUrl(absId)) return absId; + + // plugin id split + parts = pluginParts(absId); + pluginId = parts.pluginId; + absId = pluginId || parts.resourceId; + + // main id expansion + if (absId in cfg.pathMap) { + absId = cfg.pathMap[absId].main || absId; + } + + // plugin id expansion + if (pluginId) { + if (pluginId.indexOf('/') < 0 && !(pluginId in cfg.pathMap)) { + absId = joinPath(cfg.pluginPath, pluginId); + } + absId = absId + '!' + parts.resourceId; + } + + return absId; + }, + + createContext: function (cfg, baseId, depNames, isPreload) { + + var def; + + def = new Promise(); + def.id = baseId || ''; // '' == global + def.isPreload = isPreload; + def.depNames = depNames; + def.config = cfg; + + // functions that dependencies will use: + + function toAbsId (childId) { + return core.toAbsId(childId, def.id, cfg); + } + + function toUrl (n) { + // the AMD spec states that we should not append an extension + // in this function since it could already be appended. + // we need to use toAbsId in case this is a module id. + return core.resolvePathInfo(toAbsId(n), cfg).url; + } + + function localRequire (ids, callback, errback) { + var cb, rvid, childDef, earlyExport; + + // this is public, so send pure function + // also fixes issue #41 + cb = callback && function () { callback.apply(undef, arguments[0]); }; + + // RValue require (CommonJS) + if (isType(ids, 'String')) { + if (cb) { + throw new Error('require(id, callback) not allowed'); + } + // return resource + rvid = toAbsId(ids); + childDef = cache[rvid]; + if (!(rvid in cache)) { + // this should only happen when devs attempt their own + // manual wrapping of cjs modules or get confused with + // the callback syntax: + throw new Error('Module not resolved: ' + rvid); + } + earlyExport = isPromise(childDef) && childDef.exports; + return earlyExport || childDef; + } + else { + when(core.getDeps(core.createContext(cfg, def.id, ids, isPreload)), cb, errback); + } + } + + def.require = localRequire; + localRequire['toUrl'] = toUrl; + def.toAbsId = toAbsId; + + return def; + }, + + createResourceDef: function (cfg, id, isPreload) { + var def, origResolve, execute; + + def = core.createContext(cfg, id, undef, isPreload); + origResolve = def.resolve; + + // using countdown to only execute definition function once + execute = countdown(1, function (deps) { + def.deps = deps; + try { + return core.executeDefFunc(def); + } + catch (ex) { + def.reject(ex); + } + }); + + // intercept resolve function to execute definition function + // before resolving + def.resolve = function resolve (deps) { + when(isPreload || preload, function () { + origResolve((cache[def.id] = urlCache[def.url] = execute(deps))); + }); + }; + + // track exports + def.exportsReady = function executeFactory (deps) { + when(isPreload || preload, function () { + // only resolve early if we also use exports (to avoid + // circular dependencies). def.exports will have already + // been set by the getDeps loop before we get here. + if (def.exports) { + execute(deps); + def.progress(msgFactoryExecuted); + } + }); + }; + + return def; + }, + + createPluginDef: function (cfg, id, resId, isPreload) { + var def; + + // use resource id for local require and toAbsId + def = core.createContext(cfg, resId, undef, isPreload); + + return def; + }, + + getCjsRequire: function (def) { + return def.require; + }, + + getCjsExports: function (def) { + return def.exports || (def.exports = {}); + }, + + getCjsModule: function (def) { + var module = def.module; + if (!module) { + module = def.module = { + 'id': def.id, + 'uri': core.getDefUrl(def), + 'exports': core.getCjsExports(def), + 'config': function () { return def.config; } + }; + module.exports = module['exports']; // oh closure compiler! + } + return module; + }, + + getDefUrl: function (def) { + // note: this is used by cjs module.uri + return def.url || (def.url = core.checkToAddJsExt(def.require['toUrl'](def.id), def.config)); + }, + + /** + * Sets the curl() and define() APIs. + * @param [cfg] {Object|Null} set of config params. If missing or null, + * this function will set the default API! + */ + setApi: function (cfg) { + /* + scenarios: + 1. global config sets apiName: "require" + - first call to config sets api + - second and later calls are ignored + - prevCurl cannot exist + 2. no global config, first call to config() sets api + - first call to config has no api info + - second call to config sets api + - third and later calls must be ignored + 3. global config that doesn't set api, first call does though + - same as #2 + 4. api info is never set + - how to know when to stop ignoring? + + objectives: + 1. fail before mistakenly overwriting global[curlName] + 2. allow rename/relocate of curl() and define() + 3. restore curl() if we overwrote it + */ + + var apiName, defName, apiObj, defObj, + failMsg, okToOverwrite; + + apiName = curlName; + defName = defineName; + apiObj = defObj = global; + failMsg = ' already exists'; + + // if we're not setting defaults + if (cfg) { + // is it ok to overwrite existing api functions? + okToOverwrite = cfg['overwriteApi'] || cfg.overwriteApi; + // allow dev to rename/relocate curl() to another object + apiName = cfg['apiName'] || cfg.apiName || apiName; + apiObj = cfg['apiContext'] || cfg.apiContext || apiObj; + // define() too + defName = cfg['defineName'] || cfg.defineName || defName; + defObj = cfg['defineContext'] || cfg.defineContext || defObj; + + // curl() already existed, restore it if this is not a + // setDefaults pass. dev must be a good citizen and set + // apiName/apiContext (see below). + if (prevCurl && isType(prevCurl, 'Function')) { + // restore previous curl() + global[curlName] = prevCurl; + } + prevCurl = null; // don't check ever again + // ditto for define() + if (prevDefine && isType(prevDefine, 'Function')) { + // restore previous curl() + global[defineName] = prevDefine; + } + prevDefine = null; // don't check ever again + + // check if we're mistakenly overwriting either api + // if we're configuring, and there's a curl(), and it's not + // ours -- and we're not explicitly overwriting -- throw! + // Note: if we're setting defaults, we *must* overwrite curl + // so that dev can configure it. This is no different than + // noConflict()-type methods. + if (!okToOverwrite) { + if (apiObj[apiName] && apiObj[apiName] != _curl) { + throw new Error(apiName + failMsg); + } + // check if we're overwriting amd api + if (defObj[defName] && defObj[defName] != define) { + throw new Error(defName + failMsg); + } + } + + } + + // set curl api + apiObj[apiName] = _curl; + + // set AMD public api: define() + defObj[defName] = define; + + }, + + config: function (cfg) { + var prevCfg, newCfg, pluginCfgs, p; + + // convert from closure-safe names + if ('baseUrl' in cfg) cfg.baseUrl = cfg['baseUrl']; + if ('main' in cfg) cfg.main = cfg['main']; + if ('preloads' in cfg) cfg.preloads = cfg['preloads']; + if ('pluginPath' in cfg) cfg.pluginPath = cfg['pluginPath']; + if ('dontAddFileExt' in cfg || cfg.dontAddFileExt) { + cfg.dontAddFileExt = new RegExp(cfg['dontAddFileExt'] || cfg.dontAddFileExt); + } + + prevCfg = userCfg; + newCfg = beget(prevCfg, cfg); + + // create object to hold path map. + // each plugin and package will have its own pathMap, too. + newCfg.pathMap = beget(prevCfg.pathMap); + pluginCfgs = cfg['plugins'] || {}; + newCfg.plugins = beget(prevCfg.plugins); + newCfg.paths = beget(prevCfg.paths, cfg.paths); + newCfg.packages = beget(prevCfg.packages, cfg.packages); + + // temporary arrays of paths. this will be converted to + // a regexp for fast path parsing. + newCfg.pathList = []; + + // normalizes path/package info and places info on either + // the global cfg.pathMap or on a plugin-specific altCfg.pathMap. + // also populates a pathList on cfg or plugin configs. + function fixAndPushPaths (coll, isPkg) { + var id, pluginId, data, parts, currCfg, info; + for (var name in coll) { + data = coll[name]; + if (isType(data, 'String')) data = { + path: coll[name] + }; + // grab the package id, if specified. default to + // property name, if missing. + data.name = data.name || name; + currCfg = newCfg; + // check if this is a plugin-specific path + parts = pluginParts(removeEndSlash(data.name)); + id = parts.resourceId; + pluginId = parts.pluginId; + if (pluginId) { + // plugin-specific path + currCfg = pluginCfgs[pluginId]; + if (!currCfg) { + currCfg = pluginCfgs[pluginId] = beget(newCfg); + currCfg.pathMap = beget(newCfg.pathMap); + currCfg.pathList = []; + } + // remove plugin-specific path from coll + delete coll[name]; + } + if (isPkg) { + info = normalizePkgDescriptor(data); + if (info.config) info.config = beget(newCfg, info.config); + } + else { + info = { path: removeEndSlash(data.path) }; + } + info.specificity = id.split('/').length; + if (id) { + currCfg.pathMap[id] = info; + currCfg.pathList.push(id); + } + else { + // naked plugin name signifies baseUrl for plugin + // resources. baseUrl could be relative to global + // baseUrl. + currCfg.baseUrl = core.resolveUrl(data.path, newCfg); + } + } + } + + // adds the path matching regexp onto the cfg or plugin cfgs. + function convertPathMatcher (cfg) { + var pathMap = cfg.pathMap; + cfg.pathRx = new RegExp('^(' + + cfg.pathList.sort(function (a, b) { return pathMap[b].specificity - pathMap[a].specificity; } ) + .join('|') + .replace(/\/|\./g, '\\$&') + + ')(?=\\/|$)' + ); + delete cfg.pathList; + } + + // fix all new packages, then paths (in case there are + // plugin-specific paths for a main module, such as wire!) + fixAndPushPaths(cfg['packages'], true); + fixAndPushPaths(cfg['paths'], false); + + // process plugins after packages in case we already perform an + // id transform on a plugin (i.e. it's a package.main) + for (p in pluginCfgs) { + var absId = core.toAbsId(p + '!', '', newCfg); + newCfg.plugins[absId.substr(0, absId.length - 1)] = pluginCfgs[p]; + } + pluginCfgs = newCfg.plugins; + + // create search regex for each path map + for (p in pluginCfgs) { + // inherit full config + pluginCfgs[p] = beget(newCfg, pluginCfgs[p]); + var pathList = pluginCfgs[p].pathList; + if (pathList) { + pluginCfgs[p].pathList = pathList.concat(newCfg.pathList); + convertPathMatcher(pluginCfgs[p]); + } + } + + // ugh, this is ugly, but necessary until we refactor this function + // copy previous pathMap items onto pathList + for (p in prevCfg.pathMap) { + if (!newCfg.pathMap.hasOwnProperty(p)) newCfg.pathList.push(p); + } + + convertPathMatcher(newCfg); + + return newCfg; + + }, + + resolvePathInfo: function (absId, cfg) { + // searches through the configured path mappings and packages + var pathMap, pathInfo, path, pkgCfg; + + pathMap = cfg.pathMap; + + if (!isAbsUrl(absId)) { + path = absId.replace(cfg.pathRx, function (match) { + // TODO: remove fallbacks here since they should never need to happen + pathInfo = pathMap[match] || {}; + pkgCfg = pathInfo.config; + return pathInfo.path || ''; + }); + } + else { + path = absId; + } + + return { + config: pkgCfg || userCfg, + url: core.resolveUrl(path, cfg) + }; + }, + + resolveUrl: function (path, cfg) { + var baseUrl = cfg.baseUrl; + return baseUrl && !isAbsUrl(path) ? joinPath(baseUrl, path) : path; + }, + + checkToAddJsExt: function (url, cfg) { + // don't add extension if a ? is found in the url (query params) + // i'd like to move this feature to a moduleLoader + return url + ((cfg || userCfg).dontAddFileExt.test(url) ? '' : '.js'); + }, + + loadScript: function (def, success, failure) { + // script processing rules learned from RequireJS + + // insert script + var el = doc.createElement('script'); + + // initial script processing + function process (ev) { + ev = ev || global.event; + // detect when it's done loading + // ev.type == 'load' is for all browsers except IE6-9 + // IE6-9 need to use onreadystatechange and look for + // el.readyState in {loaded, complete} (yes, we need both) + if (ev.type == 'load' || readyStates[el.readyState]) { + delete activeScripts[def.id]; + // release event listeners + el.onload = el.onreadystatechange = el.onerror = ''; // ie cries if we use undefined + success(); + } + } + + function fail (e) { + // some browsers send an event, others send a string, + // but none of them send anything useful, so just say we failed: + failure(new Error('Syntax or http error: ' + def.url)); + } + + // set type first since setting other properties could + // prevent us from setting this later + // actually, we don't even need to set this at all + //el.type = 'text/javascript'; + // using dom0 event handlers instead of wordy w3c/ms + el.onload = el.onreadystatechange = process; + el.onerror = fail; + // js! plugin uses alternate mimetypes + el.type = def.mimetype || 'text/javascript'; + // TODO: support other charsets? + el.charset = 'utf-8'; + el.async = !def.order; + el.src = def.url; + + // loading will start when the script is inserted into the dom. + // IE will load the script sync if it's in the cache, so + // indicate the current resource definition if this happens. + activeScripts[def.id] = el; + + head.insertBefore(el, insertBeforeEl); + + // the js! plugin uses this + return el; + }, + + extractCjsDeps: function (defFunc) { + // Note: ignores require() inside strings and comments + var source, ids = [], currQuote; + // prefer toSource (FF) since it strips comments + source = typeof defFunc == 'string' ? + defFunc : + defFunc.toSource ? defFunc.toSource() : defFunc.toString(); + // remove comments, then look for require() or quotes + source.replace(removeCommentsRx, '').replace(findRValueRequiresRx, function (m, rq, id, qq) { + // if we encounter a string in the source, don't look for require() + if (qq) { + currQuote = currQuote == qq ? undef : currQuote; + } + // if we're not inside a quoted string + else if (!currQuote) { + ids.push(id); + } + return ''; // uses least RAM/CPU + }); + return ids; + }, + + fixArgs: function (args) { + // resolve args + // valid combinations for define: + // (string, array, object|function) sax|saf + // (array, object|function) ax|af + // (string, object|function) sx|sf + // (object|function) x|f + + var id, deps, defFunc, defFuncArity, len, cjs; + + len = args.length; + + defFunc = args[len - 1]; + defFuncArity = isType(defFunc, 'Function') ? defFunc.length : -1; + + if (len == 2) { + if (isType(args[0], 'Array')) { + deps = args[0]; + } + else { + id = args[0]; + } + } + else if (len == 3) { + id = args[0]; + deps = args[1]; + } + + // Hybrid format: assume that a definition function with zero + // dependencies and non-zero arity is a wrapped CommonJS module + if (!deps && defFuncArity > 0) { + cjs = true; + deps = ['require', 'exports', 'module'].slice(0, defFuncArity).concat(core.extractCjsDeps(defFunc)); + } + + return { + id: id, + deps: deps || [], + res: defFuncArity >= 0 ? defFunc : function () { return defFunc; }, + cjs: cjs + }; + }, + + executeDefFunc: function (def) { + var resource, moduleThis; + // the force of AMD is strong so anything returned + // overrides exports. + // node.js assumes `this` === `exports` so we do that + // for all cjs-wrapped modules, just in case. + // also, use module.exports if that was set + // (node.js convention). + // note: if .module exists, .exports exists. + moduleThis = def.cjs ? def.exports : undef; + resource = def.res.apply(moduleThis, def.deps); + if (resource === undef && def.exports) { + // note: exports will equal module.exports unless + // module.exports was reassigned inside module. + resource = def.module ? (def.exports = def.module.exports) : def.exports; + } + return resource; + }, + + defineResource: function (def, args) { + + def.res = args.res; + def.cjs = args.cjs; + def.depNames = args.deps; + core.getDeps(def); + + }, + + getDeps: function (parentDef) { + + var i, names, deps, len, dep, completed, name, + exportCollector, resolveCollector; + + deps = []; + names = parentDef.depNames; + len = names.length; + + if (names.length == 0) allResolved(); + + function collect (dep, index, alsoExport) { + deps[index] = dep; + if (alsoExport) exportCollector(dep, index); + } + + // reducer-collectors + exportCollector = countdown(len, collect, allExportsReady); + resolveCollector = countdown(len, collect, allResolved); + + // initiate the resolution of all dependencies + // Note: the correct handling of early exports relies on the + // fact that the exports pseudo-dependency is always listed + // before other module dependencies. + for (i = 0; i < len; i++) { + name = names[i]; + // is this "require", "exports", or "module"? + if (name in cjsGetters) { + // a side-effect of cjsGetters is that the cjs + // property is also set on the def. + resolveCollector(cjsGetters[name](parentDef), i, true); + // if we are using the `module` or `exports` cjs variables, + // signal any waiters/parents that we can export + // early (see progress callback in getDep below). + // note: this may fire for `require` as well, if it + // is listed after `module` or `exports` in the deps list, + // but that is okay since all waiters will only record + // it once. + if (parentDef.exports) { + parentDef.progress(msgUsingExports); + } + } + // check for blanks. fixes #32. + // this helps support yepnope.js, has.js, and the has! plugin + else if (!name) { + resolveCollector(undef, i, true); + } + // normal module or plugin resource + else { + getDep(name, i); + } + } + + return parentDef; + + function getDep (name, index) { + var resolveOnce, exportOnce, childDef, earlyExport; + + resolveOnce = countdown(1, function (dep) { + exportOnce(dep); + resolveCollector(dep, index); + }); + exportOnce = countdown(1, function (dep) { + exportCollector(dep, index); + }); + + // get child def / dep + childDef = core.fetchDep(name, parentDef); + + // check if childDef can export. if it can, then + // we missed the notification and it will never fire in the + // when() below. + earlyExport = isPromise(childDef) && childDef.exports; + if (earlyExport) { + exportOnce(earlyExport); + } + + when(childDef, + resolveOnce, + parentDef.reject, + parentDef.exports && function (msg) { + // messages are only sent from childDefs that support + // exports, and we only notify parents that understand + // exports too. + if (childDef.exports) { + if (msg == msgUsingExports) { + // if we're using exports cjs variable on both sides + exportOnce(childDef.exports); + } + else if (msg == msgFactoryExecuted) { + resolveOnce(childDef.exports); + } + } + } + ); + } + + function allResolved () { + parentDef.resolve(deps); + } + + function allExportsReady () { + parentDef.exportsReady && parentDef.exportsReady(deps); + } + + }, + + fetchResDef: function (def) { + + // ensure url is computed + core.getDefUrl(def); + + core.loadScript(def, + + function () { + var args = argsNet; + argsNet = undef; // reset it before we get deps + + // if our resource was not explicitly defined with an id (anonymous) + // Note: if it did have an id, it will be resolved in the define() + if (def.useNet !== false) { + + // if !args, nothing was added to the argsNet + if (!args || args.ex) { + def.reject(new Error(((args && args.ex) || 'define() missing or duplicated: ' + def.url))); + } + else { + core.defineResource(def, args); + } + } + + }, + + def.reject + + ); + + return def; + + }, + + fetchDep: function (depName, parentDef) { + var toAbsId, isPreload, cfg, parts, absId, mainId, loaderId, pluginId, + resId, pathInfo, def, tempDef, resCfg; + + toAbsId = parentDef.toAbsId; + isPreload = parentDef.isPreload; + cfg = parentDef.config || userCfg; // is this fallback necessary? + + absId = toAbsId(depName); + + if (absId in cache) { + // module already exists in cache + mainId = absId; + } + else { + // check for plugin loaderId + parts = pluginParts(absId); + resId = parts.resourceId; + // get id of first resource to load (which could be a plugin) + mainId = parts.pluginId || resId; + pathInfo = core.resolvePathInfo(mainId, cfg); + } + + // get custom module loader from package config if not a plugin + if (parts) { + if (parts.pluginId) { + loaderId = mainId; + } + else { + // TODO: move config.moduleLoader to config.transform + loaderId = pathInfo.config['moduleLoader'] || pathInfo.config.moduleLoader; + if (loaderId) { + // TODO: allow transforms to have relative module ids? + // (we could do this by returning package location from + // resolvePathInfo. why not return all package info?) + resId = mainId; + mainId = loaderId; + pathInfo = core.resolvePathInfo(loaderId, cfg); + } + } + } + + if (mainId in cache) { + def = cache[mainId]; + } + else if (pathInfo.url in urlCache) { + def = cache[mainId] = urlCache[pathInfo.url]; + } + else { + def = core.createResourceDef(pathInfo.config, mainId, isPreload); + // TODO: can this go inside createResourceDef? + // TODO: can we pass pathInfo.url to createResourceDef instead? + def.url = core.checkToAddJsExt(pathInfo.url, pathInfo.config); + cache[mainId] = urlCache[pathInfo.url] = def; + core.fetchResDef(def); + } + + // plugin or transformer + if (mainId == loaderId) { + + // we need to use an anonymous promise until plugin tells + // us normalized id. then, we need to consolidate the promises + // below. Note: exports objects will be different between + // pre-normalized and post-normalized defs! does this matter? + // don't put this resource def in the cache because if the + // resId doesn't change, the check if this is a new + // normalizedDef (below) will think it's already being loaded. + tempDef = new Promise(); + + // note: this means moduleLoaders can store config info in the + // plugins config, too. + resCfg = cfg.plugins[loaderId] || cfg; + + // wait for plugin resource def + when(def, function(plugin) { + var normalizedDef, fullId, dynamic; + + dynamic = plugin['dynamic']; + // check if plugin supports the normalize method + if ('normalize' in plugin) { + // note: dojo/has may return falsey values (0, actually) + resId = plugin['normalize'](resId, toAbsId, def.config) || ''; + } + else { + resId = toAbsId(resId); + } + + // use the full id (loaderId + id) to id plugin resources + // so multiple plugins may each process the same resource + // resId could be blank if the plugin doesn't require any (e.g. "domReady!") + fullId = loaderId + '!' + resId; + normalizedDef = cache[fullId]; + + // if this is our first time fetching this (normalized) def + if (!(fullId in cache)) { + + // because we're using resId, plugins, such as wire!, + // can use paths relative to the resource + normalizedDef = core.createPluginDef(resCfg, fullId, resId, isPreload); + + // don't cache non-determinate "dynamic" resources + if (!dynamic) { + cache[fullId] = normalizedDef; + } + + // curl's plugins prefer to receive a deferred, + // but to be compatible with AMD spec, we have to + // piggy-back on the callback function parameter: + var loaded = function (res) { + if (!dynamic) cache[fullId] = res; + normalizedDef.resolve(res); + }; + loaded['resolve'] = loaded; + loaded['reject'] = loaded['error'] = normalizedDef.reject; + + // load the resource! + plugin.load(resId, normalizedDef.require, loaded, resCfg); + + } + + // chain defs (resolve when plugin.load executes) + if (tempDef != normalizedDef) { + when(normalizedDef, tempDef.resolve, tempDef.reject, tempDef.progress); + } + + }, tempDef.reject); + + } + + // return tempDef if this is a plugin-based resource + return tempDef || def; + }, + + getCurrentDefName: function () { + // IE6-9 mark the currently executing thread as "interactive" + // Note: Opera lies about which scripts are "interactive", so we + // just have to test for it. Opera provides a true browser test, not + // a UA sniff, thankfully. + // learned this trick from James Burke's RequireJS + var def; + if (!isType(global.opera, 'Opera')) { + for (var d in activeScripts) { + if (activeScripts[d].readyState == 'interactive') { + def = d; + break; + } + } + } + return def; + }, + + findScript: function (predicate) { + var i = 0, scripts, script; + scripts = doc && (doc.scripts || doc.getElementsByTagName('script')); + while (scripts && (script = scripts[i++])) { + if (predicate(script)) return script; + } + }, + + extractDataAttrConfig: function (cfg) { + var script; + script = core.findScript(function (script) { + var main; + // find main module(s) in data-curl-run attr on script element + // TODO: extract baseUrl, too? + main = script.getAttribute(runModuleAttr); + if (main) cfg.main = main; + return main; + }); + // removeAttribute is wonky (in IE6?) but this works + if (script) { + script.setAttribute(runModuleAttr, ''); + } + return cfg; + }, + + nextTurn: function (task) { + setTimeout(task, 0); + } + + }; + + // hook-up cjs free variable getters + cjsGetters = {'require': core.getCjsRequire, 'exports': core.getCjsExports, 'module': core.getCjsModule}; + + function _curl (/* various */) { + var args, promise, cfg; + + args = [].slice.call(arguments); + + // extract config, if it's specified + if (isType(args[0], 'Object')) { + cfg = args.shift(); + promise = _config(cfg); + } + + return new CurlApi(args[0], args[1], args[2], promise); + } + + function _config (cfg, callback, errback) { + var pPromise, mPromise, main, devmain, fallback; + + if (cfg) { + core.setApi(cfg); + userCfg = core.config(cfg); + // check for preloads + if ('preloads' in cfg) { + pPromise = new CurlApi(cfg['preloads'], undef, errback, preload, true); + // yes, this is hacky and embarrassing. now that we've got that + // settled... until curl has deferred factory execution, this + // is the only way to stop preloads from dead-locking when + // they have dependencies inside a bundle. + core.nextTurn(function () { preload = pPromise; }); + } + // check for main module(s). all modules wait for preloads implicitly. + main = cfg['main']; + main = main && String(main).split(splitMainDirectives); + if (main) { + mPromise = new Promise(); + mPromise.then(callback, errback); + // figure out if we are using a dev-time fallback + fallback = main[1] + ? function () { new CurlApi([main[1]], mPromise.resolve, mPromise.reject); } + : mPromise.reject; + new CurlApi([main[0]], mPromise.resolve, fallback); + return mPromise; + } + } + } + + // thanks to Joop Ringelberg for helping troubleshoot the API + function CurlApi (ids, callback, errback, waitFor, isPreload) { + var then, ctx; + + ctx = core.createContext(userCfg, undef, [].concat(ids), isPreload); + + this['then'] = this.then = then = function (resolved, rejected) { + when(ctx, + // return the dependencies as arguments, not an array + function (deps) { + if (resolved) resolved.apply(undef, deps); + }, + // just throw if the dev didn't specify an error handler + function (ex) { + if (rejected) rejected(ex); else throw ex; + } + ); + return this; + }; + + this['next'] = function (ids, cb, eb) { + // chain api + return new CurlApi(ids, cb, eb, ctx); + }; + + this['config'] = _config; + + if (callback || errback) then(callback, errback); + + // ensure next-turn so inline code can execute first + core.nextTurn(function () { + when(isPreload || preload, function () { + when(waitFor, function () { core.getDeps(ctx); }, errback); + }); + }); + } + + _curl['version'] = version; + _curl['config'] = _config; + + function _define (args) { + + var id, def, pathInfo; + + id = args.id; + + if (id == undef) { + if (argsNet !== undef) { + argsNet = { ex: 'Multiple anonymous defines encountered' }; + } + else if (!(id = core.getCurrentDefName())/* intentional assignment */) { + // anonymous define(), defer processing until after script loads + argsNet = args; + } + } + if (id != undef) { + // named define(), it is in the cache if we are loading a dependency + // (could also be a secondary define() appearing in a built file, etc.) + def = cache[id]; + if (!(id in cache)) { + // id is an absolute id in this case, so we can get the config. + pathInfo = core.resolvePathInfo(id, userCfg); + def = core.createResourceDef(pathInfo.config, id); + cache[id] = def; + } + if (!isPromise(def)) throw new Error('duplicate define: ' + id); + // check if this resource has already been resolved + def.useNet = false; + core.defineResource(def, args); + } + + } + + function define () { + // wrap inner _define so it can be replaced without losing define.amd + var args = core.fixArgs(arguments); + _define(args); + } + + // indicate our capabilities: + define['amd'] = { 'plugins': true, 'jQuery': true, 'curl': version }; + + // default configs + userCfg = { + baseUrl: '', + pluginPath: 'curl/plugin', + dontAddFileExt: dontAddExtRx, + paths: {}, + packages: {}, + plugins: {}, + pathMap: {}, + pathRx: /$^/ + }; + + // look for "data-curl-run" directive, and override config + userCfg = core.extractDataAttrConfig(userCfg); + + // handle pre-existing global + prevCurl = global[curlName]; + prevDefine = global[defineName]; + + // only run config if there is something to config (perf saver?) + if (prevCurl && isType(prevCurl, 'Object') || userCfg.main) { + // remove global curl object + global[curlName] = undef; // can't use delete in IE 6-8 + // configure curl + _config(prevCurl || userCfg); + } + else { + // set default api + core.setApi(); + } + + // allow curl to be a dependency + cache[curlName] = _curl; + + // expose curl core for special plugins and modules + // Note: core overrides will only work in either of two scenarios: + // 1. the files are running un-compressed (Google Closure or Uglify) + // 2. the overriding module was compressed into the same file as curl.js + // Compiling curl and the overriding module separately won't work. + cache['curl/_privileged'] = { + 'core': core, + 'cache': cache, + 'config': function () { return userCfg; }, + '_define': _define, + '_curl': _curl, + 'Promise': Promise + }; + +}(this.window || (typeof global != 'undefined' && global) || this)); diff --git a/vendor/docdown/README.md b/vendor/docdown/README.md deleted file mode 100644 index fbddce918..000000000 --- a/vendor/docdown/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Docdown v1.0.0 - -A simple JSDoc to Markdown documentation generator. - -## Documentation - -The documentation for Docdown can be viewed here: [/doc/README.md](https://github.com/jdalton/docdown/blob/master/doc/README.md#readme) - -For a list of upcoming features, check out our [roadmap](https://github.com/jdalton/docdown/wiki/Roadmap). - -## Installation and usage - -Usage example: - -```php -require("docdown.php"); - -// generate Markdown -$markdown = docdown(array( - "path" => $filepath, - "url" => "https://github.com/username/project/blob/master/my.js" -)); -``` - -## Author - -| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---| -| [John-David Dalton](http://allyoucanleet.com/) | - -## Contributors - -| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | -|---| -| [Mathias Bynens](http://mathiasbynens.be/) | diff --git a/vendor/dojo/LICENSE b/vendor/dojo/LICENSE new file mode 100644 index 000000000..b1ddd3408 --- /dev/null +++ b/vendor/dojo/LICENSE @@ -0,0 +1,195 @@ +Dojo is available under *either* the terms of the modified BSD license *or* the +Academic Free License version 2.1. As a recipient of Dojo, you may choose which +license to receive this code under (except as noted in per-module LICENSE +files). Some modules may not be the copyright of the Dojo Foundation. These +modules contain explicit declarations of copyright in both the LICENSE files in +the directories in which they reside and in the code itself. No external +contributions are allowed under licenses which are fundamentally incompatible +with the AFL or BSD licenses that Dojo is distributed under. + +The text of the AFL and BSD licenses is reproduced below. + +------------------------------------------------------------------------------- +The "New" BSD License: +********************** + +Copyright (c) 2005-2013, The Dojo Foundation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Dojo Foundation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------- +The Academic Free License, v. 2.1: +********************************** + +This Academic Free License (the "License") applies to any original work of +authorship (the "Original Work") whose owner (the "Licensor") has placed the +following notice immediately following the copyright notice for the Original +Work: + +Licensed under the Academic Free License version 2.1 + +1) Grant of Copyright License. Licensor hereby grants You a world-wide, +royalty-free, non-exclusive, perpetual, sublicenseable license to do the +following: + +a) to reproduce the Original Work in copies; + +b) to prepare derivative works ("Derivative Works") based upon the Original +Work; + +c) to distribute copies of the Original Work and Derivative Works to the +public; + +d) to perform the Original Work publicly; and + +e) to display the Original Work publicly. + +2) Grant of Patent License. Licensor hereby grants You a world-wide, +royalty-free, non-exclusive, perpetual, sublicenseable license, under patent +claims owned or controlled by the Licensor that are embodied in the Original +Work as furnished by the Licensor, to make, use, sell and offer for sale the +Original Work and Derivative Works. + +3) Grant of Source Code License. The term "Source Code" means the preferred +form of the Original Work for making modifications to it and all available +documentation describing how to modify the Original Work. Licensor hereby +agrees to provide a machine-readable copy of the Source Code of the Original +Work along with each copy of the Original Work that Licensor distributes. +Licensor reserves the right to satisfy this obligation by placing a +machine-readable copy of the Source Code in an information repository +reasonably calculated to permit inexpensive and convenient access by You for as +long as Licensor continues to distribute the Original Work, and by publishing +the address of that information repository in a notice immediately following +the copyright notice that applies to the Original Work. + +4) Exclusions From License Grant. Neither the names of Licensor, nor the names +of any contributors to the Original Work, nor any of their trademarks or +service marks, may be used to endorse or promote products derived from this +Original Work without express prior written permission of the Licensor. Nothing +in this License shall be deemed to grant any rights to trademarks, copyrights, +patents, trade secrets or any other intellectual property of Licensor except as +expressly stated herein. No patent license is granted to make, use, sell or +offer to sell embodiments of any patent claims other than the licensed claims +defined in Section 2. No right is granted to the trademarks of Licensor even if +such marks are included in the Original Work. Nothing in this License shall be +interpreted to prohibit Licensor from licensing under different terms from this +License any Original Work that Licensor otherwise would have a right to +license. + +5) This section intentionally omitted. + +6) Attribution Rights. You must retain, in the Source Code of any Derivative +Works that You create, all copyright, patent or trademark notices from the +Source Code of the Original Work, as well as any notices of licensing and any +descriptive text identified therein as an "Attribution Notice." You must cause +the Source Code for any Derivative Works that You create to carry a prominent +Attribution Notice reasonably calculated to inform recipients that You have +modified the Original Work. + +7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that +the copyright in and to the Original Work and the patent rights granted herein +by Licensor are owned by the Licensor or are sublicensed to You under the terms +of this License with the permission of the contributor(s) of those copyrights +and patent rights. Except as expressly stated in the immediately proceeding +sentence, the Original Work is provided under this License on an "AS IS" BASIS +and WITHOUT WARRANTY, either express or implied, including, without limitation, +the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. +This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No +license to Original Work is granted hereunder except under this disclaimer. + +8) Limitation of Liability. Under no circumstances and under no legal theory, +whether in tort (including negligence), contract, or otherwise, shall the +Licensor be liable to any person for any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License +or the use of the Original Work including, without limitation, damages for loss +of goodwill, work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses. This limitation of liability shall not +apply to liability for death or personal injury resulting from Licensor's +negligence to the extent applicable law prohibits such limitation. Some +jurisdictions do not allow the exclusion or limitation of incidental or +consequential damages, so this exclusion and limitation may not apply to You. + +9) Acceptance and Termination. If You distribute copies of the Original Work or +a Derivative Work, You must make a reasonable effort under the circumstances to +obtain the express assent of recipients to the terms of this License. Nothing +else but this License (or another written agreement between Licensor and You) +grants You permission to create Derivative Works based upon the Original Work +or to exercise any of the rights granted in Section 1 herein, and any attempt +to do so except under the terms of this License (or another written agreement +between Licensor and You) is expressly prohibited by U.S. copyright law, the +equivalent laws of other countries, and by international treaty. Therefore, by +exercising any of the rights granted to You in Section 1 herein, You indicate +Your acceptance of this License and all of its terms and conditions. + +10) Termination for Patent Action. This License shall terminate automatically +and You may no longer exercise any of the rights granted to You by this License +as of the date You commence an action, including a cross-claim or counterclaim, +against Licensor or any licensee alleging that the Original Work infringes a +patent. This termination provision shall not apply for an action alleging +patent infringement by combinations of the Original Work with other software or +hardware. + +11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this +License may be brought only in the courts of a jurisdiction wherein the +Licensor resides or in which Licensor conducts its primary business, and under +the laws of that jurisdiction excluding its conflict-of-law provisions. The +application of the United Nations Convention on Contracts for the International +Sale of Goods is expressly excluded. Any use of the Original Work outside the +scope of this License or after its termination shall be subject to the +requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et +seq., the equivalent laws of other countries, and international treaty. This +section shall survive the termination of this License. + +12) Attorneys Fees. In any action to enforce the terms of this License or +seeking damages relating thereto, the prevailing party shall be entitled to +recover its costs and expenses, including, without limitation, reasonable +attorneys' fees and costs incurred in connection with such action, including +any appeal of such action. This section shall survive the termination of this +License. + +13) Miscellaneous. This License represents the complete agreement concerning +the subject matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent necessary to +make it enforceable. + +14) Definition of "You" in This License. "You" throughout this License, whether +in upper or lower case, means an individual or a legal entity exercising rights +under, and complying with all of the terms of, this License. For legal +entities, "You" includes any entity that controls, is controlled by, or is +under common control with you. For purposes of this definition, "control" means +(i) the power, direct or indirect, to cause the direction or management of such +entity, whether by contract or otherwise, or (ii) ownership of fifty percent +(50%) or more of the outstanding shares, or (iii) beneficial ownership of such +entity. + +15) Right to Use. You may use the Original Work in all ways not otherwise +restricted or conditioned by this License or by law, and Licensor promises not +to interfere with or be responsible for such uses by You. + +This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. +Permission is hereby granted to copy and distribute this license without +modification. This license may not be modified without the express written +permission of its copyright owner. diff --git a/vendor/dojo/dojo.js b/vendor/dojo/dojo.js new file mode 100644 index 000000000..54d4b8eb6 --- /dev/null +++ b/vendor/dojo/dojo.js @@ -0,0 +1,1997 @@ +(function( + userConfig, + defaultConfig +){ + // summary: + // This is the "source loader" and is the entry point for Dojo during development. You may also load Dojo with + // any AMD-compliant loader via the package main module dojo/main. + // description: + // This is the "source loader" for Dojo. It provides an AMD-compliant loader that can be configured + // to operate in either synchronous or asynchronous modes. After the loader is defined, dojo is loaded + // IAW the package main module dojo/main. In the event you wish to use a foreign loader, you may load dojo as a package + // via the package main module dojo/main and this loader is not required; see dojo/package.json for details. + // + // In order to keep compatibility with the v1.x line, this loader includes additional machinery that enables + // the dojo.provide, dojo.require et al API. This machinery is loaded by default, but may be dynamically removed + // via the has.js API and statically removed via the build system. + // + // This loader includes sniffing machinery to determine the environment; the following environments are supported: + // + // - browser + // - node.js + // - rhino + // + // This is the so-called "source loader". As such, it includes many optional features that may be discarded by + // building a customized version with the build system. + + // Design and Implementation Notes + // + // This is a dojo-specific adaption of bdLoad, donated to the dojo foundation by Altoviso LLC. + // + // This function defines an AMD-compliant (http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition) + // loader that can be configured to operate in either synchronous or asynchronous modes. + // + // Since this machinery implements a loader, it does not have the luxury of using a load system and/or + // leveraging a utility library. This results in an unpleasantly long file; here is a road map of the contents: + // + // 1. Small library for use implementing the loader. + // 2. Define the has.js API; this is used throughout the loader to bracket features. + // 3. Define the node.js and rhino sniffs and sniff. + // 4. Define the loader's data. + // 5. Define the configuration machinery. + // 6. Define the script element sniffing machinery and sniff for configuration data. + // 7. Configure the loader IAW the provided user, default, and sniffing data. + // 8. Define the global require function. + // 9. Define the module resolution machinery. + // 10. Define the module and plugin module definition machinery + // 11. Define the script injection machinery. + // 12. Define the window load detection. + // 13. Define the logging API. + // 14. Define the tracing API. + // 16. Define the AMD define function. + // 17. Define the dojo v1.x provide/require machinery--so called "legacy" modes. + // 18. Publish global variables. + // + // Language and Acronyms and Idioms + // + // moduleId: a CJS module identifier, (used for public APIs) + // mid: moduleId (used internally) + // packageId: a package identifier (used for public APIs) + // pid: packageId (used internally); the implied system or default package has pid==="" + // pack: package is used internally to reference a package object (since javascript has reserved words including "package") + // prid: plugin resource identifier + // The integer constant 1 is used in place of true and 0 in place of false. + + // define a minimal library to help build the loader + var noop = function(){ + }, + + isEmpty = function(it){ + for(var p in it){ + return 0; + } + return 1; + }, + + toString = {}.toString, + + isFunction = function(it){ + return toString.call(it) == "[object Function]"; + }, + + isString = function(it){ + return toString.call(it) == "[object String]"; + }, + + isArray = function(it){ + return toString.call(it) == "[object Array]"; + }, + + forEach = function(vector, callback){ + if(vector){ + for(var i = 0; vector[i];){ + callback(vector[i++]); + } + } + }, + + mix = function(dest, src){ + for(var p in src){ + dest[p] = src[p]; + } + return dest; + }, + + makeError = function(error, info){ + return mix(new Error(error), {src:"dojoLoader", info:info}); + }, + + uidSeed = 1, + + uid = function(){ + // Returns a unique identifier (within the lifetime of the document) of the form /_d+/. + return "_" + uidSeed++; + }, + + // FIXME: how to doc window.require() api + + // this will be the global require function; define it immediately so we can start hanging things off of it + req = function( + config, //(object, optional) hash of configuration properties + dependencies, //(array of commonjs.moduleId, optional) list of modules to be loaded before applying callback + callback //(function, optional) lambda expression to apply to module values implied by dependencies + ){ + return contextRequire(config, dependencies, callback, 0, req); + }, + + // the loader uses the has.js API to control feature inclusion/exclusion; define then use throughout + global = this, + + doc = global.document, + + element = doc && doc.createElement("DiV"), + + has = req.has = function(name){ + return isFunction(hasCache[name]) ? (hasCache[name] = hasCache[name](global, doc, element)) : hasCache[name]; + }, + + hasCache = has.cache = defaultConfig.hasCache; + + has.add = function(name, test, now, force){ + (hasCache[name]===undefined || force) && (hasCache[name] = test); + return now && has(name); + }; + + has.add("host-node", userConfig.has && "host-node" in userConfig.has ? + userConfig.has["host-node"] : + (typeof process == "object" && process.versions && process.versions.node && process.versions.v8)); + if(has("host-node")){ + // fixup the default config for node.js environment + require("./_base/configNode.js").config(defaultConfig); + // remember node's require (with respect to baseUrl==dojo's root) + defaultConfig.loaderPatch.nodeRequire = require; + } + + has.add("host-rhino", userConfig.has && "host-rhino" in userConfig.has ? + userConfig.has["host-rhino"] : + (typeof load == "function" && (typeof Packages == "function" || typeof Packages == "object"))); + if(has("host-rhino")){ + // owing to rhino's lame feature that hides the source of the script, give the user a way to specify the baseUrl... + for(var baseUrl = userConfig.baseUrl || ".", arg, rhinoArgs = this.arguments, i = 0; i < rhinoArgs.length;){ + arg = (rhinoArgs[i++] + "").split("="); + if(arg[0] == "baseUrl"){ + baseUrl = arg[1]; + break; + } + } + load(baseUrl + "/_base/configRhino.js"); + rhinoDojoConfig(defaultConfig, baseUrl, rhinoArgs); + } + + // userConfig has tests override defaultConfig has tests; do this after the environment detection because + // the environment detection usually sets some has feature values in the hasCache. + for(var p in userConfig.has){ + has.add(p, userConfig.has[p], 0, 1); + } + + // + // define the loader data + // + + // the loader will use these like symbols if the loader has the traceApi; otherwise + // define magic numbers so that modules can be provided as part of defaultConfig + var requested = 1, + arrived = 2, + nonmodule = 3, + executing = 4, + executed = 5; + + if(has("dojo-trace-api")){ + // these make debugging nice; but using strings for symbols is a gross rookie error; don't do it for production code + requested = "requested"; + arrived = "arrived"; + nonmodule = "not-a-module"; + executing = "executing"; + executed = "executed"; + } + + var legacyMode = 0, + sync = "sync", + xd = "xd", + syncExecStack = [], + dojoRequirePlugin = 0, + checkDojoRequirePlugin = noop, + transformToAmd = noop, + getXhr; + if(has("dojo-sync-loader")){ + req.isXdUrl = noop; + + req.initSyncLoader = function(dojoRequirePlugin_, checkDojoRequirePlugin_, transformToAmd_){ + // the first dojo/_base/loader loaded gets to define these variables; they are designed to work + // in the presence of zero to many mapped dojo/_base/loaders + if(!dojoRequirePlugin){ + dojoRequirePlugin = dojoRequirePlugin_; + checkDojoRequirePlugin = checkDojoRequirePlugin_; + transformToAmd = transformToAmd_; + } + + return { + sync:sync, + requested:requested, + arrived:arrived, + nonmodule:nonmodule, + executing:executing, + executed:executed, + syncExecStack:syncExecStack, + modules:modules, + execQ:execQ, + getModule:getModule, + injectModule:injectModule, + setArrived:setArrived, + signal:signal, + finishExec:finishExec, + execModule:execModule, + dojoRequirePlugin:dojoRequirePlugin, + getLegacyMode:function(){return legacyMode;}, + guardCheckComplete:guardCheckComplete + }; + }; + + if(has("dom")){ + // in legacy sync mode, the loader needs a minimal XHR library + + var locationProtocol = location.protocol, + locationHost = location.host; + req.isXdUrl = function(url){ + if(/^\./.test(url)){ + // begins with a dot is always relative to page URL; therefore not xdomain + return false; + } + if(/^\/\//.test(url)){ + // for v1.6- backcompat, url starting with // indicates xdomain + return true; + } + // get protocol and host + // \/+ takes care of the typical file protocol that looks like file:///drive/path/to/file + // locationHost is falsy if file protocol => if locationProtocol matches and is "file:", || will return false + var match = url.match(/^([^\/\:]+\:)\/+([^\/]+)/); + return match && (match[1] != locationProtocol || (locationHost && match[2] != locationHost)); + }; + + + // note: to get the file:// protocol to work in FF, you must set security.fileuri.strict_origin_policy to false in about:config + has.add("dojo-xhr-factory", 1); + has.add("dojo-force-activex-xhr", has("host-browser") && !doc.addEventListener && window.location.protocol == "file:"); + has.add("native-xhr", typeof XMLHttpRequest != "undefined"); + if(has("native-xhr") && !has("dojo-force-activex-xhr")){ + getXhr = function(){ + return new XMLHttpRequest(); + }; + }else{ + // if in the browser an old IE; find an xhr + for(var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'], progid, i = 0; i < 3;){ + try{ + progid = XMLHTTP_PROGIDS[i++]; + if(new ActiveXObject(progid)){ + // this progid works; therefore, use it from now on + break; + } + }catch(e){ + // squelch; we're just trying to find a good ActiveX progid + // if they all fail, then progid ends up as the last attempt and that will signal the error + // the first time the client actually tries to exec an xhr + } + } + getXhr = function(){ + return new ActiveXObject(progid); + }; + } + req.getXhr = getXhr; + + has.add("dojo-gettext-api", 1); + req.getText = function(url, async, onLoad){ + var xhr = getXhr(); + xhr.open('GET', fixupUrl(url), false); + xhr.send(null); + if(xhr.status == 200 || (!location.host && !xhr.status)){ + if(onLoad){ + onLoad(xhr.responseText, async); + } + }else{ + throw makeError("xhrFailed", xhr.status); + } + return xhr.responseText; + }; + } + }else{ + req.async = 1; + } + + // + // loader eval + // + var eval_ = + // use the function constructor so our eval is scoped close to (but not in) in the global space with minimal pollution + new Function('return eval(arguments[0]);'); + + req.eval = + function(text, hint){ + return eval_(text + "\r\n////@ sourceURL=" + hint); + }; + + // + // loader micro events API + // + var listenerQueues = {}, + error = "error", + signal = req.signal = function(type, args){ + var queue = listenerQueues[type]; + // notice we run a copy of the queue; this allows listeners to add/remove + // other listeners without affecting this particular signal + forEach(queue && queue.slice(0), function(listener){ + listener.apply(null, isArray(args) ? args : [args]); + }); + }, + on = req.on = function(type, listener){ + // notice a queue is not created until a client actually connects + var queue = listenerQueues[type] || (listenerQueues[type] = []); + queue.push(listener); + return { + remove:function(){ + for(var i = 0; i (alias, actual) + = [], + + paths + // CommonJS paths + = {}, + + pathsMapProg + // list of (from-path, to-path, regex, length) derived from paths; + // a "program" to apply paths; see computeMapProg + = [], + + packs + // a map from packageId to package configuration object; see fixupPackageInfo + = {}, + + map = req.map + // AMD map config variable; dojo/_base/kernel needs req.map to figure out the scope map + = {}, + + mapProgs + // vector of quads as described by computeMapProg; map-key is AMD map key, map-value is AMD map value + = [], + + modules + // A hash:(mid) --> (module-object) the module namespace + // + // pid: the package identifier to which the module belongs (e.g., "dojo"); "" indicates the system or default package + // mid: the fully-resolved (i.e., mappings have been applied) module identifier without the package identifier (e.g., "dojo/io/script") + // url: the URL from which the module was retrieved + // pack: the package object of the package to which the module belongs + // executed: 0 => not executed; executing => in the process of traversing deps and running factory; executed => factory has been executed + // deps: the dependency vector for this module (vector of modules objects) + // def: the factory for this module + // result: the result of the running the factory for this module + // injected: (0 | requested | arrived) the status of the module; nonmodule means the resource did not call define + // load: plugin load function; applicable only for plugins + // + // Modules go through several phases in creation: + // + // 1. Requested: some other module's definition or a require application contained the requested module in + // its dependency vector or executing code explicitly demands a module via req.require. + // + // 2. Injected: a script element has been appended to the insert-point element demanding the resource implied by the URL + // + // 3. Loaded: the resource injected in [2] has been evaluated. + // + // 4. Defined: the resource contained a define statement that advised the loader about the module. Notice that some + // resources may just contain a bundle of code and never formally define a module via define + // + // 5. Evaluated: the module was defined via define and the loader has evaluated the factory and computed a result. + = {}, + + cacheBust + // query string to append to module URLs to bust browser cache + = "", + + cache + // hash:(mid | url)-->(function | string) + // + // A cache of resources. The resources arrive via a config.cache object, which is a hash from either mid --> function or + // url --> string. The url key is distinguished from the mid key by always containing the prefix "url:". url keys as provided + // by config.cache always have a string value that represents the contents of the resource at the given url. mid keys as provided + // by configl.cache always have a function value that causes the same code to execute as if the module was script injected. + // + // Both kinds of key-value pairs are entered into cache via the function consumePendingCache, which may relocate keys as given + // by any mappings *iff* the config.cache was received as part of a module resource request. + // + // Further, for mid keys, the implied url is computed and the value is entered into that key as well. This allows mapped modules + // to retrieve cached items that may have arrived consequent to another namespace. + // + = {}, + + urlKeyPrefix + // the prefix to prepend to a URL key in the cache. + = "url:", + + pendingCacheInsert + // hash:(mid)-->(function) + // + // Gives a set of cache modules pending entry into cache. When cached modules are published to the loader, they are + // entered into pendingCacheInsert; modules are then pressed into cache upon (1) AMD define or (2) upon receiving another + // independent set of cached modules. (1) is the usual case, and this case allows normalizing mids given in the pending + // cache for the local configuration, possibly relocating modules. + = {}, + + dojoSniffConfig + // map of configuration variables + // give the data-dojo-config as sniffed from the document (if any) + = {}, + + insertPointSibling + // the nodes used to locate where scripts are injected into the document + = 0; + + if(has("dojo-config-api")){ + var consumePendingCacheInsert = function(referenceModule){ + var p, item, match, now, m; + for(p in pendingCacheInsert){ + item = pendingCacheInsert[p]; + match = p.match(/^url\:(.+)/); + if(match){ + cache[urlKeyPrefix + toUrl(match[1], referenceModule)] = item; + }else if(p=="*now"){ + now = item; + }else if(p!="*noref"){ + m = getModuleInfo(p, referenceModule); + cache[m.mid] = cache[urlKeyPrefix + m.url] = item; + } + } + if(now){ + now(createRequire(referenceModule)); + } + pendingCacheInsert = {}; + }, + + escapeString = function(s){ + return s.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function(c){ return "\\" + c; }); + }, + + computeMapProg = function(map, dest){ + // This routine takes a map as represented by a JavaScript object and initializes dest, a vector of + // quads of (map-key, map-value, refex-for-map-key, length-of-map-key), sorted decreasing by length- + // of-map-key. The regex looks for the map-key followed by either "/" or end-of-string at the beginning + // of a the search source. Notice the map-value is irrelevant to the algorithm + dest.splice(0, dest.length); + for(var p in map){ + dest.push([ + p, + map[p], + new RegExp("^" + escapeString(p) + "(\/|$)"), + p.length]); + } + dest.sort(function(lhs, rhs){ return rhs[3] - lhs[3]; }); + return dest; + }, + + computeAliases = function(config, dest){ + forEach(config, function(pair){ + // take a fixed-up copy... + dest.push([isString(pair[0]) ? new RegExp("^" + escapeString(pair[0]) + "$") : pair[0], pair[1]]); + }); + }, + + + fixupPackageInfo = function(packageInfo){ + // calculate the precise (name, location, main, mappings) for a package + var name = packageInfo.name; + if(!name){ + // packageInfo must be a string that gives the name + name = packageInfo; + packageInfo = {name:name}; + } + packageInfo = mix({main:"main"}, packageInfo); + packageInfo.location = packageInfo.location ? packageInfo.location : name; + + // packageMap is deprecated in favor of AMD map + if(packageInfo.packageMap){ + map[name] = packageInfo.packageMap; + } + + if(!packageInfo.main.indexOf("./")){ + packageInfo.main = packageInfo.main.substring(2); + } + + // now that we've got a fully-resolved package object, push it into the configuration + packs[name] = packageInfo; + }, + + delayedModuleConfig + // module config cannot be consumed until the loader is completely initialized; therefore, all + // module config detected during booting is memorized and applied at the end of loader initialization + // TODO: this is a bit of a kludge; all config should be moved to end of loader initialization, but + // we'll delay this chore and do it with a final loader 1.x cleanup after the 2.x loader prototyping is complete + = [], + + + config = function(config, booting, referenceModule){ + for(var p in config){ + if(p=="waitSeconds"){ + req.waitms = (config[p] || 0) * 1000; + } + if(p=="cacheBust"){ + cacheBust = config[p] ? (isString(config[p]) ? config[p] : (new Date()).getTime() + "") : ""; + } + if(p=="baseUrl" || p=="combo"){ + req[p] = config[p]; + } + if(has("dojo-sync-loader") && p=="async"){ + // falsy or "sync" => legacy sync loader + // "xd" => sync but loading xdomain tree and therefore loading asynchronously (not configurable, set automatically by the loader) + // "legacyAsync" => permanently in "xd" by choice + // "debugAtAllCosts" => trying to load everything via script injection (not implemented) + // otherwise, must be truthy => AMD + // legacyMode: sync | legacyAsync | xd | false + var mode = config[p]; + req.legacyMode = legacyMode = (isString(mode) && /sync|legacyAsync/.test(mode) ? mode : (!mode ? sync : false)); + req.async = !legacyMode; + } + if(config[p]!==hasCache){ + // accumulate raw config info for client apps which can use this to pass their own config + req.rawConfig[p] = config[p]; + p!="has" && has.add("config-"+p, config[p], 0, booting); + } + } + + // make sure baseUrl exists + if(!req.baseUrl){ + req.baseUrl = "./"; + } + // make sure baseUrl ends with a slash + if(!/\/$/.test(req.baseUrl)){ + req.baseUrl += "/"; + } + + // now do the special work for has, packages, packagePaths, paths, aliases, and cache + + for(p in config.has){ + has.add(p, config.has[p], 0, booting); + } + + // for each package found in any packages config item, augment the packs map owned by the loader + forEach(config.packages, fixupPackageInfo); + + // for each packagePath found in any packagePaths config item, augment the packageConfig + // packagePaths is deprecated; remove in 2.0 + for(baseUrl in config.packagePaths){ + forEach(config.packagePaths[baseUrl], function(packageInfo){ + var location = baseUrl + "/" + packageInfo; + if(isString(packageInfo)){ + packageInfo = {name:packageInfo}; + } + packageInfo.location = location; + fixupPackageInfo(packageInfo); + }); + } + + // notice that computeMapProg treats the dest as a reference; therefore, if/when that variable + // is published (see dojo-publish-privates), the published variable will always hold a valid value. + + // this must come after all package processing since package processing may mutate map + computeMapProg(mix(map, config.map), mapProgs); + forEach(mapProgs, function(item){ + item[1] = computeMapProg(item[1], []); + if(item[0]=="*"){ + mapProgs.star = item; + } + }); + + // push in any paths and recompute the internal pathmap + computeMapProg(mix(paths, config.paths), pathsMapProg); + + // aliases + computeAliases(config.aliases, aliases); + + if(booting){ + delayedModuleConfig.push({config:config.config}); + }else{ + for(p in config.config){ + var module = getModule(p, referenceModule); + module.config = mix(module.config || {}, config.config[p]); + } + } + + // push in any new cache values + if(config.cache){ + consumePendingCacheInsert(); + pendingCacheInsert = config.cache; + if(config.cache["*noref"]){ + consumePendingCacheInsert(); + } + } + + signal("config", [config, req.rawConfig]); + }; + + // + // execute the various sniffs; userConfig can override and value + // + + if(has("dojo-cdn") || has("dojo-sniff")){ + // the sniff regex looks for a src attribute ending in dojo.js, optionally preceded with a path. + // match[3] returns the path to dojo.js (if any) without the trailing slash. This is used for the + // dojo location on CDN deployments and baseUrl when either/both of these are not provided + // explicitly in the config data; this is the 1.6- behavior. + + var scripts = doc.getElementsByTagName("script"), + i = 0, + script, dojoDir, src, match; + while(i < scripts.length){ + script = scripts[i++]; + if((src = script.getAttribute("src")) && (match = src.match(/(((.*)\/)|^)dojo\.js(\W|$)/i))){ + // sniff dojoDir and baseUrl + dojoDir = match[3] || ""; + defaultConfig.baseUrl = defaultConfig.baseUrl || dojoDir; + + // remember an insertPointSibling + insertPointSibling = script; + } + + // sniff configuration on attribute in script element + if((src = (script.getAttribute("data-dojo-config") || script.getAttribute("djConfig")))){ + dojoSniffConfig = req.eval("({ " + src + " })", "data-dojo-config"); + + // remember an insertPointSibling + insertPointSibling = script; + } + + // sniff requirejs attribute + if(has("dojo-requirejs-api")){ + if((src = script.getAttribute("data-main"))){ + dojoSniffConfig.deps = dojoSniffConfig.deps || [src]; + } + } + } + } + + if(has("dojo-test-sniff")){ + // pass down doh.testConfig from parent as if it were a data-dojo-config + try{ + if(window.parent != window && window.parent.require){ + var doh = window.parent.require("doh"); + doh && mix(dojoSniffConfig, doh.testConfig); + } + }catch(e){} + } + + // configure the loader; let the user override defaults + req.rawConfig = {}; + config(defaultConfig, 1); + + // do this before setting userConfig/sniffConfig to allow userConfig/sniff overrides + if(has("dojo-cdn")){ + packs.dojo.location = dojoDir; + if(dojoDir){ + dojoDir += "/"; + } + packs.dijit.location = dojoDir + "../dijit/"; + packs.dojox.location = dojoDir + "../dojox/"; + } + + config(userConfig, 1); + config(dojoSniffConfig, 1); + + }else{ + // no config API, assume defaultConfig has everything the loader needs...for the entire lifetime of the application + paths = defaultConfig.paths; + pathsMapProg = defaultConfig.pathsMapProg; + packs = defaultConfig.packs; + aliases = defaultConfig.aliases; + mapProgs = defaultConfig.mapProgs; + modules = defaultConfig.modules; + cache = defaultConfig.cache; + cacheBust = defaultConfig.cacheBust; + + // remember the default config for other processes (e.g., dojo/config) + req.rawConfig = defaultConfig; + } + + + if(has("dojo-combo-api")){ + req.combo = req.combo || {add:noop}; + var comboPending = 0, + combosPending = [], + comboPendingTimer = null; + } + + + // build the loader machinery iaw configuration, including has feature tests + var injectDependencies = function(module){ + // checkComplete!=0 holds the idle signal; we're not idle if we're injecting dependencies + guardCheckComplete(function(){ + forEach(module.deps, injectModule); + if(has("dojo-combo-api") && comboPending && !comboPendingTimer){ + comboPendingTimer = setTimeout(function() { + comboPending = 0; + comboPendingTimer = null; + req.combo.done(function(mids, url) { + var onLoadCallback= function(){ + // defQ is a vector of module definitions 1-to-1, onto mids + runDefQ(0, mids); + checkComplete(); + }; + combosPending.push(mids); + injectingModule = mids; + req.injectUrl(url, onLoadCallback, mids); + injectingModule = 0; + }, req); + }, 0); + } + }); + }, + + contextRequire = function(a1, a2, a3, referenceModule, contextRequire){ + var module, syntheticMid; + if(isString(a1)){ + // signature is (moduleId) + module = getModule(a1, referenceModule, true); + if(module && module.executed){ + return module.result; + } + throw makeError("undefinedModule", a1); + } + if(!isArray(a1)){ + // a1 is a configuration + config(a1, 0, referenceModule); + + // juggle args; (a2, a3) may be (dependencies, callback) + a1 = a2; + a2 = a3; + } + if(isArray(a1)){ + // signature is (requestList [,callback]) + if(!a1.length){ + a2 && a2(); + }else{ + syntheticMid = "require*" + uid(); + + // resolve the request list with respect to the reference module + for(var mid, deps = [], i = 0; i < a1.length;){ + mid = a1[i++]; + deps.push(getModule(mid, referenceModule)); + } + + // construct a synthetic module to control execution of the requestList, and, optionally, callback + module = mix(makeModuleInfo("", syntheticMid, 0, ""), { + injected: arrived, + deps: deps, + def: a2 || noop, + require: referenceModule ? referenceModule.require : req, + gc: 1 //garbage collect + }); + modules[module.mid] = module; + + // checkComplete!=0 holds the idle signal; we're not idle if we're injecting dependencies + injectDependencies(module); + + // try to immediately execute + // if already traversing a factory tree, then strict causes circular dependency to abort the execution; maybe + // it's possible to execute this require later after the current traversal completes and avoid the circular dependency. + // ...but *always* insist on immediate in synch mode + var strict = checkCompleteGuard && legacyMode!=sync; + guardCheckComplete(function(){ + execModule(module, strict); + }); + if(!module.executed){ + // some deps weren't on board or circular dependency detected and strict; therefore, push into the execQ + execQ.push(module); + } + checkComplete(); + } + } + return contextRequire; + }, + + createRequire = function(module){ + if(!module){ + return req; + } + var result = module.require; + if(!result){ + result = function(a1, a2, a3){ + return contextRequire(a1, a2, a3, module, result); + }; + module.require = mix(result, req); + result.module = module; + result.toUrl = function(name){ + return toUrl(name, module); + }; + result.toAbsMid = function(mid){ + return toAbsMid(mid, module); + }; + if(has("dojo-undef-api")){ + result.undef = function(mid){ + req.undef(mid, module); + }; + } + if(has("dojo-sync-loader")){ + result.syncLoadNls = function(mid){ + var nlsModuleInfo = getModuleInfo(mid, module), + nlsModule = modules[nlsModuleInfo.mid]; + if(!nlsModule || !nlsModule.executed){ + cached = cache[nlsModuleInfo.mid] || cache[urlKeyPrefix + nlsModuleInfo.url]; + if(cached){ + evalModuleText(cached); + nlsModule = modules[nlsModuleInfo.mid]; + } + } + return nlsModule && nlsModule.executed && nlsModule.result; + }; + } + + } + return result; + }, + + execQ = + // The list of modules that need to be evaluated. + [], + + defQ = + // The queue of define arguments sent to loader. + [], + + waiting = + // The set of modules upon which the loader is waiting for definition to arrive + {}, + + setRequested = function(module){ + module.injected = requested; + waiting[module.mid] = 1; + if(module.url){ + waiting[module.url] = module.pack || 1; + } + startTimer(); + }, + + setArrived = function(module){ + module.injected = arrived; + delete waiting[module.mid]; + if(module.url){ + delete waiting[module.url]; + } + if(isEmpty(waiting)){ + clearTimer(); + has("dojo-sync-loader") && legacyMode==xd && (legacyMode = sync); + } + }, + + execComplete = req.idle = + // says the loader has completed (or not) its work + function(){ + return !defQ.length && isEmpty(waiting) && !execQ.length && !checkCompleteGuard; + }, + + runMapProg = function(targetMid, map){ + // search for targetMid in map; return the map item if found; falsy otherwise + if(map){ + for(var i = 0; i < map.length; i++){ + if(map[i][2].test(targetMid)){ + return map[i]; + } + } + } + return 0; + }, + + compactPath = function(path){ + var result = [], + segment, lastSegment; + path = path.replace(/\\/g, '/').split('/'); + while(path.length){ + segment = path.shift(); + if(segment==".." && result.length && lastSegment!=".."){ + result.pop(); + lastSegment = result[result.length - 1]; + }else if(segment!="."){ + result.push(lastSegment= segment); + } // else ignore "." + } + return result.join("/"); + }, + + makeModuleInfo = function(pid, mid, pack, url){ + if(has("dojo-sync-loader")){ + var xd= req.isXdUrl(url); + return {pid:pid, mid:mid, pack:pack, url:url, executed:0, def:0, isXd:xd, isAmd:!!(xd || (packs[pid] && packs[pid].isAmd))}; + }else{ + return {pid:pid, mid:mid, pack:pack, url:url, executed:0, def:0}; + } + }, + + getModuleInfo_ = function(mid, referenceModule, packs, modules, baseUrl, mapProgs, pathsMapProg, aliases, alwaysCreate){ + // arguments are passed instead of using lexical variables so that this function my be used independent of the loader (e.g., the builder) + // alwaysCreate is useful in this case so that getModuleInfo never returns references to real modules owned by the loader + var pid, pack, midInPackage, mapItem, url, result, isRelative, requestedMid; + requestedMid = mid; + isRelative = /^\./.test(mid); + if(/(^\/)|(\:)|(\.js$)/.test(mid) || (isRelative && !referenceModule)){ + // absolute path or protocol of .js filetype, or relative path but no reference module and therefore relative to page + // whatever it is, it's not a module but just a URL of some sort + // note: pid===0 indicates the routine is returning an unmodified mid + + return makeModuleInfo(0, mid, 0, mid); + }else{ + // relative module ids are relative to the referenceModule; get rid of any dots + mid = compactPath(isRelative ? (referenceModule.mid + "/../" + mid) : mid); + if(/^\./.test(mid)){ + throw makeError("irrationalPath", mid); + } + // at this point, mid is an absolute mid + + // map the mid + if(referenceModule){ + mapItem = runMapProg(referenceModule.mid, mapProgs); + } + mapItem = mapItem || mapProgs.star; + mapItem = mapItem && runMapProg(mid, mapItem[1]); + + if(mapItem){ + mid = mapItem[1] + mid.substring(mapItem[3]); + } + + match = mid.match(/^([^\/]+)(\/(.+))?$/); + pid = match ? match[1] : ""; + if((pack = packs[pid])){ + mid = pid + "/" + (midInPackage = (match[3] || pack.main)); + }else{ + pid = ""; + } + + // search aliases + var candidateLength = 0, + candidate = 0; + forEach(aliases, function(pair){ + var match = mid.match(pair[0]); + if(match && match.length>candidateLength){ + candidate = isFunction(pair[1]) ? mid.replace(pair[0], pair[1]) : pair[1]; + } + }); + if(candidate){ + return getModuleInfo_(candidate, 0, packs, modules, baseUrl, mapProgs, pathsMapProg, aliases, alwaysCreate); + } + + result = modules[mid]; + if(result){ + return alwaysCreate ? makeModuleInfo(result.pid, result.mid, result.pack, result.url) : modules[mid]; + } + } + // get here iff the sought-after module does not yet exist; therefore, we need to compute the URL given the + // fully resolved (i.e., all relative indicators and package mapping resolved) module id + + // note: pid!==0 indicates the routine is returning a url that has .js appended unmodified mid + mapItem = runMapProg(mid, pathsMapProg); + if(mapItem){ + url = mapItem[1] + mid.substring(mapItem[3]); + }else if(pid){ + url = pack.location + "/" + midInPackage; + }else if(has("config-tlmSiblingOfDojo")){ + url = "../" + mid; + }else{ + url = mid; + } + // if result is not absolute, add baseUrl + if(!(/(^\/)|(\:)/.test(url))){ + url = baseUrl + url; + } + url += ".js"; + return makeModuleInfo(pid, mid, pack, compactPath(url)); + }, + + getModuleInfo = function(mid, referenceModule){ + return getModuleInfo_(mid, referenceModule, packs, modules, req.baseUrl, mapProgs, pathsMapProg, aliases); + }, + + resolvePluginResourceId = function(plugin, prid, referenceModule){ + return plugin.normalize ? plugin.normalize(prid, function(mid){return toAbsMid(mid, referenceModule);}) : toAbsMid(prid, referenceModule); + }, + + dynamicPluginUidGenerator = 0, + + getModule = function(mid, referenceModule, immediate){ + // compute and optionally construct (if necessary) the module implied by the mid with respect to referenceModule + var match, plugin, prid, result; + match = mid.match(/^(.+?)\!(.*)$/); + if(match){ + // name was ! + plugin = getModule(match[1], referenceModule, immediate); + + if(has("dojo-sync-loader") && legacyMode == sync && !plugin.executed){ + injectModule(plugin); + if(plugin.injected===arrived && !plugin.executed){ + guardCheckComplete(function(){ + execModule(plugin); + }); + } + if(plugin.executed){ + promoteModuleToPlugin(plugin); + }else{ + // we are in xdomain mode for some reason + execQ.unshift(plugin); + } + } + + + + if(plugin.executed === executed && !plugin.load){ + // executed the module not knowing it was a plugin + promoteModuleToPlugin(plugin); + } + + // if the plugin has not been loaded, then can't resolve the prid and must assume this plugin is dynamic until we find out otherwise + if(plugin.load){ + prid = resolvePluginResourceId(plugin, match[2], referenceModule); + mid = (plugin.mid + "!" + (plugin.dynamic ? ++dynamicPluginUidGenerator + "!" : "") + prid); + }else{ + prid = match[2]; + mid = plugin.mid + "!" + (++dynamicPluginUidGenerator) + "!waitingForPlugin"; + } + result = {plugin:plugin, mid:mid, req:createRequire(referenceModule), prid:prid}; + }else{ + result = getModuleInfo(mid, referenceModule); + } + return modules[result.mid] || (!immediate && (modules[result.mid] = result)); + }, + + toAbsMid = req.toAbsMid = function(mid, referenceModule){ + return getModuleInfo(mid, referenceModule).mid; + }, + + toUrl = req.toUrl = function(name, referenceModule){ + var moduleInfo = getModuleInfo(name+"/x", referenceModule), + url= moduleInfo.url; + return fixupUrl(moduleInfo.pid===0 ? + // if pid===0, then name had a protocol or absolute path; either way, toUrl is the identify function in such cases + name : + // "/x.js" since getModuleInfo automatically appends ".js" and we appended "/x" to make name look like a module id + url.substring(0, url.length-5) + ); + }, + + nonModuleProps = { + injected: arrived, + executed: executed, + def: nonmodule, + result: nonmodule + }, + + makeCjs = function(mid){ + return modules[mid] = mix({mid:mid}, nonModuleProps); + }, + + cjsRequireModule = makeCjs("require"), + cjsExportsModule = makeCjs("exports"), + cjsModuleModule = makeCjs("module"), + + runFactory = function(module, args){ + req.trace("loader-run-factory", [module.mid]); + var factory = module.def, + result; + has("dojo-sync-loader") && syncExecStack.unshift(module); + if(has("config-dojo-loader-catches")){ + try{ + result= isFunction(factory) ? factory.apply(null, args) : factory; + }catch(e){ + signal(error, module.result = makeError("factoryThrew", [module, e])); + } + }else{ + result= isFunction(factory) ? factory.apply(null, args) : factory; + } + module.result = result===undefined && module.cjs ? module.cjs.exports : result; + has("dojo-sync-loader") && syncExecStack.shift(module); + }, + + abortExec = {}, + + defOrder = 0, + + promoteModuleToPlugin = function(pluginModule){ + var plugin = pluginModule.result; + pluginModule.dynamic = plugin.dynamic; + pluginModule.normalize = plugin.normalize; + pluginModule.load = plugin.load; + return pluginModule; + }, + + resolvePluginLoadQ = function(plugin){ + // plugins is a newly executed module that has a loadQ waiting to run + + // step 1: traverse the loadQ and fixup the mid and prid; remember the map from original mid to new mid + // recall the original mid was created before the plugin was on board and therefore it was impossible to + // compute the final mid; accordingly, prid may or may not change, but the mid will definitely change + var map = {}; + forEach(plugin.loadQ, function(pseudoPluginResource){ + // manufacture and insert the real module in modules + var prid = resolvePluginResourceId(plugin, pseudoPluginResource.prid, pseudoPluginResource.req.module), + mid = plugin.dynamic ? pseudoPluginResource.mid.replace(/waitingForPlugin$/, prid) : (plugin.mid + "!" + prid), + pluginResource = mix(mix({}, pseudoPluginResource), {mid:mid, prid:prid, injected:0}); + if(!modules[mid]){ + // create a new (the real) plugin resource and inject it normally now that the plugin is on board + injectPlugin(modules[mid] = pluginResource); + } // else this was a duplicate request for the same (plugin, rid) for a nondynamic plugin + + // pluginResource is really just a placeholder with the wrong mid (because we couldn't calculate it until the plugin was on board) + // mark is as arrived and delete it from modules; the real module was requested above + map[pseudoPluginResource.mid] = modules[mid]; + setArrived(pseudoPluginResource); + delete modules[pseudoPluginResource.mid]; + }); + plugin.loadQ = 0; + + // step2: replace all references to any placeholder modules with real modules + var substituteModules = function(module){ + for(var replacement, deps = module.deps || [], i = 0; i")]); + return (!module.def || strict) ? abortExec : (module.cjs && module.cjs.exports); + } + // at this point the module is either not executed or fully executed + + + if(!module.executed){ + if(!module.def){ + return abortExec; + } + var mid = module.mid, + deps = module.deps || [], + arg, argResult, + args = [], + i = 0; + + if(has("dojo-trace-api")){ + circleTrace.push(mid); + req.trace("loader-exec-module", ["exec", circleTrace.length, mid]); + } + + // for circular dependencies, assume the first module encountered was executed OK + // modules that circularly depend on a module that has not run its factory will get + // the pre-made cjs.exports===module.result. They can take a reference to this object and/or + // add properties to it. When the module finally runs its factory, the factory can + // read/write/replace this object. Notice that so long as the object isn't replaced, any + // reference taken earlier while walking the deps list is still valid. + module.executed = executing; + while((arg = deps[i++])){ + argResult = ((arg === cjsRequireModule) ? createRequire(module) : + ((arg === cjsExportsModule) ? module.cjs.exports : + ((arg === cjsModuleModule) ? module.cjs : + execModule(arg, strict)))); + if(argResult === abortExec){ + module.executed = 0; + req.trace("loader-exec-module", ["abort", mid]); + has("dojo-trace-api") && circleTrace.pop(); + return abortExec; + } + args.push(argResult); + } + runFactory(module, args); + finishExec(module); + has("dojo-trace-api") && circleTrace.pop(); + } + // at this point the module is guaranteed fully executed + + return module.result; + }, + + + checkCompleteGuard = 0, + + guardCheckComplete = function(proc){ + try{ + checkCompleteGuard++; + proc(); + }finally{ + checkCompleteGuard--; + } + if(execComplete()){ + signal("idle", []); + } + }, + + checkComplete = function(){ + // keep going through the execQ as long as at least one factory is executed + // plugins, recursion, cached modules all make for many execution path possibilities + if(checkCompleteGuard){ + return; + } + guardCheckComplete(function(){ + checkDojoRequirePlugin(); + for(var currentDefOrder, module, i = 0; i < execQ.length;){ + currentDefOrder = defOrder; + module = execQ[i]; + execModule(module); + if(currentDefOrder!=defOrder){ + // defOrder was bumped one or more times indicating something was executed (note, this indicates + // the execQ was modified, maybe a lot (for example a later module causes an earlier module to execute) + checkDojoRequirePlugin(); + i = 0; + }else{ + // nothing happened; check the next module in the exec queue + i++; + } + } + }); + }; + + + if(has("dojo-undef-api")){ + req.undef = function(moduleId, referenceModule){ + // In order to reload a module, it must be undefined (this routine) and then re-requested. + // This is useful for testing frameworks (at least). + var module = getModule(moduleId, referenceModule); + setArrived(module); + mix(module, {def:0, executed:0, injected:0, node:0}); + }; + } + + if(has("dojo-inject-api")){ + if(has("dojo-loader-eval-hint-url")===undefined){ + has.add("dojo-loader-eval-hint-url", 1); + } + + var fixupUrl= function(url){ + url += ""; // make sure url is a Javascript string (some paths may be a Java string) + return url + (cacheBust ? ((/\?/.test(url) ? "&" : "?") + cacheBust) : ""); + }, + + injectPlugin = function( + module + ){ + // injects the plugin module given by module; may have to inject the plugin itself + var plugin = module.plugin; + + if(plugin.executed === executed && !plugin.load){ + // executed the module not knowing it was a plugin + promoteModuleToPlugin(plugin); + } + + var onLoad = function(def){ + module.result = def; + setArrived(module); + finishExec(module); + checkComplete(); + }; + + if(plugin.load){ + plugin.load(module.prid, module.req, onLoad); + }else if(plugin.loadQ){ + plugin.loadQ.push(module); + }else{ + // the unshift instead of push is important: we don't want plugins to execute as + // dependencies of some other module because this may cause circles when the plugin + // loadQ is run; also, generally, we want plugins to run early since they may load + // several other modules and therefore can potentially unblock many modules + plugin.loadQ = [module]; + execQ.unshift(plugin); + injectModule(plugin); + } + }, + + // for IE, injecting a module may result in a recursive execution if the module is in the cache + + cached = 0, + + injectingModule = 0, + + injectingCachedModule = 0, + + evalModuleText = function(text, module){ + // see def() for the injectingCachedModule bracket; it simply causes a short, safe circuit + if(has("config-stripStrict")){ + text = text.replace(/"use strict"/g, ''); + } + injectingCachedModule = 1; + if(has("config-dojo-loader-catches")){ + try{ + if(text===cached){ + cached.call(null); + }else{ + req.eval(text, has("dojo-loader-eval-hint-url") ? module.url : module.mid); + } + }catch(e){ + signal(error, makeError("evalModuleThrew", module)); + } + }else{ + if(text===cached){ + cached.call(null); + }else{ + req.eval(text, has("dojo-loader-eval-hint-url") ? module.url : module.mid); + } + } + injectingCachedModule = 0; + }, + + injectModule = function(module){ + // Inject the module. In the browser environment, this means appending a script element into + // the document; in other environments, it means loading a file. + // + // If in synchronous mode, then get the module synchronously if it's not xdomainLoading. + + var mid = module.mid, + url = module.url; + if(module.executed || module.injected || waiting[mid] || (module.url && ((module.pack && waiting[module.url]===module.pack) || waiting[module.url]==1))){ + return; + } + setRequested(module); + + if(has("dojo-combo-api")){ + var viaCombo = 0; + if(module.plugin && module.plugin.isCombo){ + // a combo plugin; therefore, must be handled by combo service + // the prid should have already been converted to a URL (if required by the plugin) during + // the normalize process; in any event, there is no way for the loader to know how to + // to the conversion; therefore the third argument is zero + req.combo.add(module.plugin.mid, module.prid, 0, req); + viaCombo = 1; + }else if(!module.plugin){ + viaCombo = req.combo.add(0, module.mid, module.url, req); + } + if(viaCombo){ + comboPending= 1; + return; + } + } + + if(module.plugin){ + injectPlugin(module); + return; + } // else a normal module (not a plugin) + + + var onLoadCallback = function(){ + runDefQ(module); + if(module.injected !== arrived){ + // the script that contained the module arrived and has been executed yet + // nothing was added to the defQ (so it wasn't an AMD module) and the module + // wasn't marked as arrived by dojo.provide (so it wasn't a v1.6- module); + // therefore, it must not have been a module; adjust state accordingly + if(has("dojo-enforceDefine")){ + signal(error, makeError("noDefine", module)); + return; + } + setArrived(module); + mix(module, nonModuleProps); + req.trace("loader-define-nonmodule", [module.url]); + } + + if(has("dojo-sync-loader") && legacyMode){ + // must call checkComplete even in for sync loader because we may be in xdomainLoading mode; + // but, if xd loading, then don't call checkComplete until out of the current sync traversal + // in order to preserve order of execution of the dojo.required modules + !syncExecStack.length && checkComplete(); + }else{ + checkComplete(); + } + }; + cached = cache[mid] || cache[urlKeyPrefix + module.url]; + if(cached){ + req.trace("loader-inject", ["cache", module.mid, url]); + evalModuleText(cached, module); + onLoadCallback(); + return; + } + if(has("dojo-sync-loader") && legacyMode){ + if(module.isXd){ + // switch to async mode temporarily; if current legacyMode!=sync, then is must be one of {legacyAsync, xd, false} + legacyMode==sync && (legacyMode = xd); + // fall through and load via script injection + }else if(module.isAmd && legacyMode!=sync){ + // fall through and load via script injection + }else{ + // mode may be sync, xd/legacyAsync, or async; module may be AMD or legacy; but module is always located on the same domain + var xhrCallback = function(text){ + if(legacyMode==sync){ + // the top of syncExecStack gives the current synchronously executing module; the loader needs + // to know this if it has to switch to async loading in the middle of evaluating a legacy module + // this happens when a modules dojo.require's a module that must be loaded async because it's xdomain + // (using unshift/shift because there is no back() methods for Javascript arrays) + syncExecStack.unshift(module); + evalModuleText(text, module); + syncExecStack.shift(); + + // maybe the module was an AMD module + runDefQ(module); + + // legacy modules never get to defineModule() => cjs and injected never set; also evaluation implies executing + if(!module.cjs){ + setArrived(module); + finishExec(module); + } + + if(module.finish){ + // while synchronously evaluating this module, dojo.require was applied referencing a module + // that had to be loaded async; therefore, the loader stopped answering all dojo.require + // requests so they could be answered completely in the correct sequence; module.finish gives + // the list of dojo.requires that must be re-applied once all target modules are available; + // make a synthetic module to execute the dojo.require's in the correct order + + // compute a guaranteed-unique mid for the synthetic finish module; remember the finish vector; remove it from the reference module + // TODO: can we just leave the module.finish...what's it hurting? + var finishMid = mid + "*finish", + finish = module.finish; + delete module.finish; + + def(finishMid, ["dojo", ("dojo/require!" + finish.join(",")).replace(/\./g, "/")], function(dojo){ + forEach(finish, function(mid){ dojo.require(mid); }); + }); + // unshift, not push, which causes the current traversal to be reattempted from the top + execQ.unshift(getModule(finishMid)); + } + onLoadCallback(); + }else{ + text = transformToAmd(module, text); + if(text){ + evalModuleText(text, module); + onLoadCallback(); + }else{ + // if transformToAmd returned falsy, then the module was already AMD and it can be script-injected + // do so to improve debugability(even though it means another download...which probably won't happen with a good browser cache) + injectingModule = module; + req.injectUrl(fixupUrl(url), onLoadCallback, module); + injectingModule = 0; + } + } + }; + + req.trace("loader-inject", ["xhr", module.mid, url, legacyMode!=sync]); + if(has("config-dojo-loader-catches")){ + try{ + req.getText(url, legacyMode!=sync, xhrCallback); + }catch(e){ + signal(error, makeError("xhrInjectFailed", [module, e])); + } + }else{ + req.getText(url, legacyMode!=sync, xhrCallback); + } + return; + } + } // else async mode or fell through in xdomain loading mode; either way, load by script injection + req.trace("loader-inject", ["script", module.mid, url]); + injectingModule = module; + req.injectUrl(fixupUrl(url), onLoadCallback, module); + injectingModule = 0; + }, + + defineModule = function(module, deps, def){ + req.trace("loader-define-module", [module.mid, deps]); + + if(has("dojo-combo-api") && module.plugin && module.plugin.isCombo){ + // the module is a plugin resource loaded by the combo service + // note: check for module.plugin should be enough since normal plugin resources should + // not follow this path; module.plugin.isCombo is future-proofing belt and suspenders + module.result = isFunction(def) ? def() : def; + setArrived(module); + finishExec(module); + return module; + } + + var mid = module.mid; + if(module.injected === arrived){ + signal(error, makeError("multipleDefine", module)); + return module; + } + mix(module, { + deps: deps, + def: def, + cjs: { + id: module.mid, + uri: module.url, + exports: (module.result = {}), + setExports: function(exports){ + module.cjs.exports = exports; + }, + config:function(){ + return module.config; + } + } + }); + + // resolve deps with respect to this module + for(var i = 0; deps[i]; i++){ + deps[i] = getModule(deps[i], module); + } + + if(has("dojo-sync-loader") && legacyMode && !waiting[mid]){ + // the module showed up without being asked for; it was probably in a - - -## CommonJS Environments - - var JSON3 = require("./path/to/json3"); - JSON3.parse("[1, 2, 3]"); - // => [1, 2, 3] - -## JavaScript Engines - - load("path/to/json3.js"); - JSON.stringify({"Hello": 123, "Good-bye": 456}, ["Hello"], "\t"); - // => '{\n\t"Hello": 123\n}' - -# Compatibility # - -JSON 3 has been **tested** with the following web browsers, CommonJS environments, and JavaScript engines. - -## Web Browsers - -- Windows [Internet Explorer](http://www.microsoft.com/windows/internet-explorer), version 6.0 and higher -- Mozilla [Firefox](http://www.mozilla.com/firefox), version 1.0 and higher -- Apple [Safari](http://www.apple.com/safari), version 2.0 and higher -- [Opera](http://www.opera.com) 7.02 and higher -- [Mozilla](http://sillydog.org/narchive/gecko.php) 1.0, [Netscape](http://sillydog.org/narchive/) 6.2.3, and [SeaMonkey](http://www.seamonkey-project.org/) 1.0 and higher - -## CommonJS Environments - -- [Node](http://nodejs.org/) 0.2.6 and higher -- [RingoJS](http://ringojs.org/) 0.4 and higher -- [Narwhal](http://narwhaljs.org/) 0.3.2 and higher - -## JavaScript Engines - -- Mozilla [Rhino](http://www.mozilla.org/rhino) 1.5R5 and higher -- WebKit [JSC](https://trac.webkit.org/wiki/JSC) -- Google [V8](http://code.google.com/p/v8) - -## Known Incompatibilities - -* Attempting to serialize the `arguments` object may produce inconsistent results across environments due to specification version differences. As a workaround, please convert the `arguments` object to an array first: `JSON.stringify([].slice.call(arguments, 0))`. - -## Required Native Methods - -JSON 3 assumes that the following methods exist and function as described in the ECMAScript specification: - -- The `Number`, `String`, `Array`, `Object`, `Date`, `SyntaxError`, and `TypeError` constructors. -- `String.fromCharCode` -- `Object#toString` -- `Function#call` -- `Math.floor` -- `Number#toString` -- `Date#valueOf` -- `String.prototype`: `indexOf`, `charCodeAt`, `charAt`, `slice`. -- `Array.prototype`: `push`, `pop`, `join`. - -# Contribute # - -Check out a working copy of the JSON 3 source code with [Git](http://git-scm.com/): - - $ git clone git://github.com/bestiejs/json3.git - $ cd json3 - $ git submodule update --init - -If you'd like to contribute a feature or bug fix, you can [fork](http://help.github.com/fork-a-repo/) JSON 3, commit your changes, and [send a pull request](http://help.github.com/send-pull-requests/). Please make sure to update the unit tests in the `test` directory as well. - -Alternatively, you can use the [GitHub issue tracker](https://github.com/bestiejs/json3/issues) to submit bug reports, feature requests, and questions, or send tweets to [@kitcambridge](http://twitter.com/kitcambridge). - -JSON 3 is released under the [MIT License](http://kit.mit-license.org/). \ No newline at end of file diff --git a/vendor/json3/lib/json3.js b/vendor/json3/lib/json3.js index b152b27ff..21d0f8fae 100644 --- a/vendor/json3/lib/json3.js +++ b/vendor/json3/lib/json3.js @@ -1,41 +1,36 @@ -/*! JSON v3.2.4 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */ -;(function () { +/*! JSON v3.2.5 | http://bestiejs.github.io/json3 | Copyright 2012-2013, Kit Cambridge | http://kit.mit-license.org */ +;(function (window) { // Convenience aliases. var getClass = {}.toString, isProperty, forEach, undef; // Detect the `define` function exposed by asynchronous module loaders. The // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof define === "function" && define.amd, JSON3 = !isLoader && typeof exports == "object" && exports; + var isLoader = typeof define === "function" && define.amd, JSON3 = typeof exports == "object" && exports; if (JSON3 || isLoader) { if (typeof JSON == "object" && JSON) { // Delegate to the native `stringify` and `parse` implementations in // asynchronous module loaders and CommonJS environments. - if (isLoader) { - JSON3 = JSON; - } else { + if (JSON3) { JSON3.stringify = JSON.stringify; JSON3.parse = JSON.parse; + } else { + JSON3 = JSON; } } else if (isLoader) { - JSON3 = this.JSON = {}; + JSON3 = window.JSON = {}; } } else { // Export for web browsers and JavaScript engines. - JSON3 = this.JSON || (this.JSON = {}); + JSON3 = window.JSON || (window.JSON = {}); } - // Local variables. - var Escapes, toPaddedString, quote, serialize; - var fromCharCode, Unescapes, abort, lex, get, walk, update, Index, Source; - // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - var isExtended = new Date(-3509827334573292), floor, Months, getDay; - + var isExtended = new Date(-3509827334573292); try { // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() == 1 && + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && // Safari < 2.0.2 stores the internal millisecond time value correctly, // but clips the values returned by the date methods to the range of // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]). @@ -45,11 +40,17 @@ // Internal: Determines whether the native `JSON.stringify` and `parse` // implementations are spec-compliant. Based on work by Ken Snyder. function has(name) { - var stringifySupported, parseSupported, value, serialized = '{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}', all = name == "json"; - if (all || name == "json-stringify" || name == "json-parse") { + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + return "a"[0] != "a"; + } + var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}', isAll = name == "json"; + if (isAll || name == "json-stringify" || name == "json-parse") { // Test `JSON.stringify`. - if (name == "json-stringify" || all) { - if ((stringifySupported = typeof JSON3.stringify == "function" && isExtended)) { + if (name == "json-stringify" || isAll) { + var stringify = JSON3.stringify, stringifySupported = typeof stringify == "function" && isExtended; + if (stringifySupported) { // A test function object with a custom `toJSON` method. (value = function () { return 1; @@ -58,86 +59,88 @@ stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean // primitives as object literals. - JSON3.stringify(0) === "0" && + stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object // literals. - JSON3.stringify(new Number()) === "0" && - JSON3.stringify(new String()) == '""' && + stringify(new Number()) === "0" && + stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or // does not define a canonical JSON representation (this applies to // objects with `toJSON` properties as well, *unless* they are nested // within an object or array). - JSON3.stringify(getClass) === undef && + stringify(getClass) === undef && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and // FF 3.1b3 pass this test. - JSON3.stringify(undef) === undef && + stringify(undef) === undef && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, // respectively, if the value is omitted entirely. - JSON3.stringify() === undef && + stringify() === undef && // FF 3.1b1, 2 throw an error if the given value is not a number, // string, array, object, Boolean, or `null` literal. This applies to // objects with custom `toJSON` methods as well, unless they are nested // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` // methods entirely. - JSON3.stringify(value) === "1" && - JSON3.stringify([value]) == "[1]" && + stringify(value) === "1" && + stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of // `"[null]"`. - JSON3.stringify([undef]) == "[null]" && + stringify([undef]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. - JSON3.stringify(null) == "null" && + stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: // `[1, true, getClass, 1]` serializes as "[1,true,],". These versions // of Firefox also allow trailing commas in JSON objects and arrays. // FF 3.1b3 elides non-JSON values from objects and arrays, unless they // define custom `toJSON` methods. - JSON3.stringify([undef, getClass, null]) == "[null,null,null]" && + stringify([undef, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences // where character escape codes are expected (e.g., `\b` => `\u0008`). - JSON3.stringify({ "A": [value, true, false, null, "\0\b\n\f\r\t"] }) == serialized && + stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - JSON3.stringify(null, value) === "1" && - JSON3.stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && + stringify(null, value) === "1" && + stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly // serialize extended years. - JSON3.stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. - JSON3.stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative // four-digit years instead of six-digit years. Credits: @Yaffle. - JSON3.stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond // values less than 1000. Credits: @Yaffle. - JSON3.stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; } catch (exception) { stringifySupported = false; } } - if (!all) { + if (!isAll) { return stringifySupported; } } // Test `JSON.parse`. - if (name == "json-parse" || all) { - if (typeof JSON3.parse == "function") { + if (name == "json-parse" || isAll) { + var parse = JSON3.parse; + if (typeof parse == "function") { try { // FF 3.1b1, b2 will throw an exception if a bare literal is provided. // Conforming implementations should also coerce the initial argument to // a string prior to parsing. - if (JSON3.parse("0") === 0 && !JSON3.parse(false)) { + if (parse("0") === 0 && !parse(false)) { // Simple parsing test. - value = JSON3.parse(serialized); - if ((parseSupported = value.A.length == 5 && value.A[0] == 1)) { + value = parse(serialized); + var parseSupported = value["a"].length == 5 && value["a"][0] === 1; + if (parseSupported) { try { // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !JSON3.parse('"\t"'); + parseSupported = !parse('"\t"'); } catch (exception) {} if (parseSupported) { try { // FF 4.0 and 4.0.1 allow leading `+` signs, and leading and // trailing decimal points. FF 4.0, 4.0.1, and IE 9-10 also // allow certain octal literals. - parseSupported = JSON3.parse("01") != 1; + parseSupported = parse("01") !== 1; } catch (exception) {} } } @@ -146,7 +149,7 @@ parseSupported = false; } } - if (!all) { + if (!isAll) { return parseSupported; } } @@ -155,19 +158,30 @@ } if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]"; + var dateClass = "[object Date]"; + var numberClass = "[object Number]"; + var stringClass = "[object String]"; + var arrayClass = "[object Array]"; + var booleanClass = "[object Boolean]"; + + // Detect incomplete support for accessing string characters by index. + var charIndexBuggy = has("bug-string-char-index"); + // Define additional utility methods if the `Date` methods are buggy. if (!isExtended) { - floor = Math.floor; + var floor = Math.floor; // A mapping between the months of the year and the number of days between // January 1st and the first of the respective month. - Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; + var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the // first day of the given month. - getDay = function (year, month) { + var getDay = function (year, month) { return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); }; } - + // Internal: Determines if a property is a direct property of the given // object. Delegates to the native `Object#hasOwnProperty` method. if (!(isProperty = {}.hasOwnProperty)) { @@ -233,7 +247,7 @@ // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable // properties. forEach = function (object, callback) { - var isFunction = getClass.call(object) == "[object Function]", property, length; + var isFunction = getClass.call(object) == functionClass, property, length; for (property in object) { // Gecko <= 1.0 enumerates the `prototype` property of functions under // certain conditions; IE does not. @@ -248,7 +262,7 @@ // Safari <= 2.0.4 enumerates shadowed properties twice. forEach = function (object, callback) { // Create a set of iterated properties. - var members = {}, isFunction = getClass.call(object) == "[object Function]", property; + var members = {}, isFunction = getClass.call(object) == functionClass, property; for (property in object) { // Store each property name to prevent double enumeration. The // `prototype` property of functions is not enumerated due to cross- @@ -261,7 +275,7 @@ } else { // No bugs detected; use the standard `for...in` algorithm. forEach = function (object, callback) { - var isFunction = getClass.call(object) == "[object Function]", property, isConstructor; + var isFunction = getClass.call(object) == functionClass, property, isConstructor; for (property in object) { if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { callback(property); @@ -285,48 +299,65 @@ // level of the output. if (!has("json-stringify")) { // Internal: A map of control characters and their escaped equivalents. - Escapes = { - "\\": "\\\\", - '"': '\\"', - "\b": "\\b", - "\f": "\\f", - "\n": "\\n", - "\r": "\\r", - "\t": "\\t" + var Escapes = { + 92: "\\\\", + 34: '\\"', + 8: "\\b", + 12: "\\f", + 10: "\\n", + 13: "\\r", + 9: "\\t" }; // Internal: Converts `value` into a zero-padded string such that its // length is at least equal to `width`. The `width` must be <= 6. - toPaddedString = function (width, value) { + var leadingZeroes = "000000"; + var toPaddedString = function (width, value) { // The `|| 0` expression is necessary to work around a bug in // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. - return ("000000" + (value || 0)).slice(-width); + return (leadingZeroes + (value || 0)).slice(-width); }; // Internal: Double-quotes a string `value`, replacing all ASCII control // characters (characters with code unit values between 0 and 31) with // their escaped equivalents. This is an implementation of the // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - quote = function (value) { - var result = '"', index = 0, symbol; - for (; symbol = value.charAt(index); index++) { - // Escape the reverse solidus, double quote, backspace, form feed, line - // feed, carriage return, and tab characters. - result += '\\"\b\f\n\r\t'.indexOf(symbol) > -1 ? Escapes[symbol] : - // If the character is a control character, append its Unicode escape - // sequence; otherwise, append the character as-is. - (Escapes[symbol] = symbol < " " ? "\\u00" + toPaddedString(2, symbol.charCodeAt(0).toString(16)) : symbol); + var unicodePrefix = "\\u00"; + var quote = function (value) { + var result = '"', index = 0, length = value.length, isLarge = length > 10 && charIndexBuggy, symbols; + if (isLarge) { + symbols = value.split(""); + } + for (; index < length; index++) { + var charCode = value.charCodeAt(index); + // If the character is a control character, append its Unicode or + // shorthand escape sequence; otherwise, append the character as-is. + switch (charCode) { + case 8: case 9: case 10: case 12: case 13: case 34: case 92: + result += Escapes[charCode]; + break; + default: + if (charCode < 32) { + result += unicodePrefix + toPaddedString(2, charCode.toString(16)); + break; + } + result += isLarge ? symbols[index] : charIndexBuggy ? value.charAt(index) : value[index]; + } } return result + '"'; }; // Internal: Recursively serializes an object. Implements the // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. - serialize = function (property, object, callback, properties, whitespace, indentation, stack) { - var value = object[property], className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, any, result; + var serialize = function (property, object, callback, properties, whitespace, indentation, stack) { + var value = object[property], className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, hasMembers, result; + try { + // Necessary for host object support. + value = object[property]; + } catch (exception) {} if (typeof value == "object" && value) { className = getClass.call(value); - if (className == "[object Date]" && !isProperty.call(value, "toJSON")) { + if (className == dateClass && !isProperty.call(value, "toJSON")) { if (value > -1 / 0 && value < 1 / 0) { // Dates are serialized according to the `Date#toJSON` method // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 @@ -370,7 +401,7 @@ } else { value = null; } - } else if (typeof value.toJSON == "function" && ((className != "[object Number]" && className != "[object String]" && className != "[object Array]") || isProperty.call(value, "toJSON"))) { + } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) { // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3 // ignores all `toJSON` methods on these objects unless they are @@ -387,14 +418,14 @@ return "null"; } className = getClass.call(value); - if (className == "[object Boolean]") { + if (className == booleanClass) { // Booleans are represented literally. return "" + value; - } else if (className == "[object Number]") { + } else if (className == numberClass) { // JSON numbers must be finite. `Infinity` and `NaN` are serialized as // `"null"`. return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - } else if (className == "[object String]") { + } else if (className == stringClass) { // Strings are double-quoted and escaped. return quote(value); } @@ -414,13 +445,13 @@ // Save the current indentation level and indent one additional level. prefix = indentation; indentation += whitespace; - if (className == "[object Array]") { + if (className == arrayClass) { // Recursively serialize array elements. - for (index = 0, length = value.length; index < length; any || (any = true), index++) { + for (index = 0, length = value.length; index < length; hasMembers || (hasMembers = true), index++) { element = serialize(index, value, callback, properties, whitespace, indentation, stack); results.push(element === undef ? "null" : element); } - result = any ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; + result = hasMembers ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; } else { // Recursively serialize object members. Members are selected from // either a user-specified list of property names, or the object @@ -436,9 +467,9 @@ // `JSON.stringify`. results.push(quote(property) + ":" + (whitespace ? " " : "") + element); } - any || (any = true); + hasMembers || (hasMembers = true); }); - result = any ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; + result = hasMembers ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; } // Remove the object from the traversed object stack. stack.pop(); @@ -448,24 +479,24 @@ // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. JSON3.stringify = function (source, filter, width) { - var whitespace, callback, properties, index, length, value; + var whitespace, callback, properties; if (typeof filter == "function" || typeof filter == "object" && filter) { - if (getClass.call(filter) == "[object Function]") { + if (getClass.call(filter) == functionClass) { callback = filter; - } else if (getClass.call(filter) == "[object Array]") { + } else if (getClass.call(filter) == arrayClass) { // Convert the property names array into a makeshift set. properties = {}; - for (index = 0, length = filter.length; index < length; value = filter[index++], ((getClass.call(value) == "[object String]" || getClass.call(value) == "[object Number]") && (properties[value] = 1))); + for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((getClass.call(value) == stringClass || getClass.call(value) == numberClass) && (properties[value] = 1))); } } if (width) { - if (getClass.call(width) == "[object Number]") { + if (getClass.call(width) == numberClass) { // Convert the `width` to an integer and create a string containing // `width` number of space characters. if ((width -= width % 1) > 0) { for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " "); } - } else if (getClass.call(width) == "[object String]") { + } else if (getClass.call(width) == stringClass) { whitespace = width.length <= 10 ? width : width.slice(0, 10); } } @@ -478,22 +509,26 @@ // Public: Parses a JSON source string. if (!has("json-parse")) { - fromCharCode = String.fromCharCode; + var fromCharCode = String.fromCharCode; + // Internal: A map of escaped control characters and their unescaped // equivalents. - Unescapes = { - "\\": "\\", - '"': '"', - "/": "/", - "b": "\b", - "t": "\t", - "n": "\n", - "f": "\f", - "r": "\r" + var Unescapes = { + 92: "\\", + 34: '"', + 47: "/", + 98: "\b", + 116: "\t", + 110: "\n", + 102: "\f", + 114: "\r" }; + // Internal: Stores the parser state. + var Index, Source; + // Internal: Resets the parser state and throws a `SyntaxError`. - abort = function() { + var abort = function() { Index = Source = null; throw SyntaxError(); }; @@ -501,140 +536,156 @@ // Internal: Returns the next token, or `"$"` if the parser has reached // the end of the source string. A token may be a string, number, `null` // literal, or Boolean literal. - lex = function () { - var source = Source, length = source.length, symbol, value, begin, position, sign; + var lex = function () { + var source = Source, length = source.length, value, begin, position, isSigned, charCode; while (Index < length) { - symbol = source.charAt(Index); - if ("\t\r\n ".indexOf(symbol) > -1) { - // Skip whitespace tokens, including tabs, carriage returns, line - // feeds, and space characters. - Index++; - } else if ("{}[]:,".indexOf(symbol) > -1) { - // Parse a punctuator token at the current position. - Index++; - return symbol; - } else if (symbol == '"') { - // Advance to the next character and parse a JSON string at the - // current position. String tokens are prefixed with the sentinel - // `@` character to distinguish them from punctuators. - for (value = "@", Index++; Index < length;) { - symbol = source.charAt(Index); - if (symbol < " ") { - // Unescaped ASCII control characters are not permitted. - abort(); - } else if (symbol == "\\") { - // Parse escaped JSON control characters, `"`, `\`, `/`, and - // Unicode escape sequences. - symbol = source.charAt(++Index); - if ('\\"/btnfr'.indexOf(symbol) > -1) { - // Revive escaped control characters. - value += Unescapes[symbol]; - Index++; - } else if (symbol == "u") { - // Advance to the first character of the escape sequence. - begin = ++Index; - // Validate the Unicode escape sequence. - for (position = Index + 4; Index < position; Index++) { - symbol = source.charAt(Index); - // A valid sequence comprises four hexdigits that form a - // single hexadecimal value. - if (!(symbol >= "0" && symbol <= "9" || symbol >= "a" && symbol <= "f" || symbol >= "A" && symbol <= "F")) { - // Invalid Unicode escape sequence. - abort(); - } - } - // Revive the escaped character. - value += fromCharCode("0x" + source.slice(begin, Index)); - } else { - // Invalid escape sequence. - abort(); - } - } else { - if (symbol == '"') { - // An unescaped double-quote character marks the end of the - // string. - break; - } - // Append the original character as-is. - value += symbol; - Index++; - } - } - if (source.charAt(Index) == '"') { + charCode = source.charCodeAt(Index); + switch (charCode) { + case 9: case 10: case 13: case 32: + // Skip whitespace tokens, including tabs, carriage returns, line + // feeds, and space characters. + Index++; + break; + case 123: case 125: case 91: case 93: case 58: case 44: + // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at + // the current position. + value = charIndexBuggy ? source.charAt(Index) : source[Index]; Index++; - // Return the revived string. return value; - } - // Unterminated string. - abort(); - } else { - // Parse numbers and literals. - begin = Index; - // Advance the scanner's position past the sign, if one is - // specified. - if (symbol == "-") { - sign = true; - symbol = source.charAt(++Index); - } - // Parse an integer or floating-point value. - if (symbol >= "0" && symbol <= "9") { - // Leading zeroes are interpreted as octal literals. - if (symbol == "0" && (symbol = source.charAt(Index + 1), symbol >= "0" && symbol <= "9")) { - // Illegal octal literal. + case 34: + // `"` delimits a JSON string; advance to the next character and + // begin parsing the string. String tokens are prefixed with the + // sentinel `@` character to distinguish them from punctuators and + // end-of-string tokens. + for (value = "@", Index++; Index < length;) { + charCode = source.charCodeAt(Index); + if (charCode < 32) { + // Unescaped ASCII control characters (those with a code unit + // less than the space character) are not permitted. + abort(); + } else if (charCode == 92) { + // A reverse solidus (`\`) marks the beginning of an escaped + // control character (including `"`, `\`, and `/`) or Unicode + // escape sequence. + charCode = source.charCodeAt(++Index); + switch (charCode) { + case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: + // Revive escaped control characters. + value += Unescapes[charCode]; + Index++; + break; + case 117: + // `\u` marks the beginning of a Unicode escape sequence. + // Advance to the first character and validate the + // four-digit code point. + begin = ++Index; + for (position = Index + 4; Index < position; Index++) { + charCode = source.charCodeAt(Index); + // A valid sequence comprises four hexdigits (case- + // insensitive) that form a single hexadecimal value. + if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { + // Invalid Unicode escape sequence. + abort(); + } + } + // Revive the escaped character. + value += fromCharCode("0x" + source.slice(begin, Index)); + break; + default: + // Invalid escape sequence. + abort(); + } + } else { + if (charCode == 34) { + // An unescaped double-quote character marks the end of the + // string. + break; + } + charCode = source.charCodeAt(Index); + begin = Index; + // Optimize for the common case where a string is valid. + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } + // Append the string as-is. + value += source.slice(begin, Index); + } + } + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } + // Unterminated string. + abort(); + default: + // Parse numbers and literals. + begin = Index; + // Advance past the negative sign, if one is specified. + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } + // Parse an integer or floating-point value. + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } + isSigned = false; + // Parse the integer component. + for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++); + // Floats cannot contain a leading decimal point; however, this + // case is already accounted for by the parser. + if (source.charCodeAt(Index) == 46) { + position = ++Index; + // Parse the decimal component. + for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); + if (position == Index) { + // Illegal trailing decimal. + abort(); + } + Index = position; + } + // Parse exponents. The `e` denoting the exponent is + // case-insensitive. + charCode = source.charCodeAt(Index); + if (charCode == 101 || charCode == 69) { + charCode = source.charCodeAt(++Index); + // Skip past the sign following the exponent, if one is + // specified. + if (charCode == 43 || charCode == 45) { + Index++; + } + // Parse the exponential component. + for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); + if (position == Index) { + // Illegal empty exponent. + abort(); + } + Index = position; + } + // Coerce the parsed value to a JavaScript number. + return +source.slice(begin, Index); + } + // A negative sign may only precede numbers. + if (isSigned) { abort(); } - sign = false; - // Parse the integer component. - for (; Index < length && (symbol = source.charAt(Index), symbol >= "0" && symbol <= "9"); Index++); - // Floats cannot contain a leading decimal point; however, this - // case is already accounted for by the parser. - if (source.charAt(Index) == ".") { - position = ++Index; - // Parse the decimal component. - for (; position < length && (symbol = source.charAt(position), symbol >= "0" && symbol <= "9"); position++); - if (position == Index) { - // Illegal trailing decimal. - abort(); - } - Index = position; + // `true`, `false`, and `null` literals. + if (source.slice(Index, Index + 4) == "true") { + Index += 4; + return true; + } else if (source.slice(Index, Index + 5) == "false") { + Index += 5; + return false; + } else if (source.slice(Index, Index + 4) == "null") { + Index += 4; + return null; } - // Parse exponents. - symbol = source.charAt(Index); - if (symbol == "e" || symbol == "E") { - // Skip past the sign following the exponent, if one is - // specified. - symbol = source.charAt(++Index); - if (symbol == "+" || symbol == "-") { - Index++; - } - // Parse the exponential component. - for (position = Index; position < length && (symbol = source.charAt(position), symbol >= "0" && symbol <= "9"); position++); - if (position == Index) { - // Illegal empty exponent. - abort(); - } - Index = position; - } - // Coerce the parsed value to a JavaScript number. - return +source.slice(begin, Index); - } - // A negative sign may only precede numbers. - if (sign) { + // Unrecognized token. abort(); - } - // `true`, `false`, and `null` literals. - if (source.slice(Index, Index + 4) == "true") { - Index += 4; - return true; - } else if (source.slice(Index, Index + 5) == "false") { - Index += 5; - return false; - } else if (source.slice(Index, Index + 4) == "null") { - Index += 4; - return null; - } - // Unrecognized token. - abort(); } } // Return the sentinel `$` character if the parser has reached the end @@ -643,14 +694,14 @@ }; // Internal: Parses a JSON `value` token. - get = function (value) { - var results, any, key; + var get = function (value) { + var results, hasMembers; if (value == "$") { // Unexpected end of input. abort(); } if (typeof value == "string") { - if (value.charAt(0) == "@") { + if (value[0] == "@") { // Remove the sentinel `@` character. return value.slice(1); } @@ -658,7 +709,7 @@ if (value == "[") { // Parses a JSON array, returning a new JavaScript array. results = []; - for (;; any || (any = true)) { + for (;; hasMembers || (hasMembers = true)) { value = lex(); // A closing square bracket marks the end of the array literal. if (value == "]") { @@ -667,7 +718,7 @@ // If the array literal contains elements, the current token // should be a comma separating the previous element from the // next. - if (any) { + if (hasMembers) { if (value == ",") { value = lex(); if (value == "]") { @@ -689,7 +740,7 @@ } else if (value == "{") { // Parses a JSON object, returning a new JavaScript object. results = {}; - for (;; any || (any = true)) { + for (;; hasMembers || (hasMembers = true)) { value = lex(); // A closing curly brace marks the end of the object literal. if (value == "}") { @@ -697,7 +748,7 @@ } // If the object literal contains members, the current token // should be a comma separator. - if (any) { + if (hasMembers) { if (value == ",") { value = lex(); if (value == "}") { @@ -712,7 +763,7 @@ // Leading commas are not permitted, object property names must be // double-quoted strings, and a `:` must separate each property // name and value. - if (value == "," || typeof value != "string" || value.charAt(0) != "@" || lex() != ":") { + if (value == "," || typeof value != "string" || value[0] != "@" || lex() != ":") { abort(); } results[value.slice(1)] = get(lex()); @@ -726,7 +777,7 @@ }; // Internal: Updates a traversed object member. - update = function(source, property, callback) { + var update = function(source, property, callback) { var element = walk(source, property, callback); if (element === undef) { delete source[property]; @@ -738,17 +789,17 @@ // Internal: Recursively traverses a parsed JSON object, invoking the // `callback` function for each value. This is an implementation of the // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. - walk = function (source, property, callback) { + var walk = function (source, property, callback) { var value = source[property], length; if (typeof value == "object" && value) { - if (getClass.call(value) == "[object Array]") { + // `forEach` can't be used to traverse an array in Opera <= 8.54 + // because its `Object#hasOwnProperty` implementation returns `false` + // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). + if (getClass.call(value) == arrayClass) { for (length = value.length; length--;) { update(value, length, callback); } } else { - // `forEach` can't be used to traverse an array in Opera <= 8.54, - // as `Object#hasOwnProperty` returns `false` for array indices - // (e.g., `![1, 2, 3].hasOwnProperty("0")`). forEach(value, function (property) { update(value, property, callback); }); @@ -761,7 +812,7 @@ JSON3.parse = function (source, callback) { var result, value; Index = 0; - Source = source; + Source = "" + source; result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. if (lex() != "$") { @@ -769,7 +820,7 @@ } // Reset the parser state. Index = Source = null; - return callback && getClass.call(callback) == "[object Function]" ? walk((value = {}, value[""] = result, value), "", callback) : result; + return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; }; } } @@ -780,4 +831,4 @@ return JSON3; }); } -}).call(this); \ No newline at end of file +}(this)); diff --git a/vendor/platform.js/README.md b/vendor/platform.js/README.md deleted file mode 100644 index 8c773f122..000000000 --- a/vendor/platform.js/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# Platform.js v1.0.0 - -A platform detection library that works on nearly all JavaScript platforms1. - -## Disclaimer - -Platform.js is for informational purposes only and **not** intended as a substitution for [feature detection/inference](http://allyoucanleet.com/post/18087210413/feature-testing-costs#screencast2) checks. - -## BestieJS - -Platform.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation. - -## Documentation - -The documentation for Platform.js can be viewed here: [/doc/README.md](https://github.com/bestiejs/platform.js/blob/master/doc/README.md#readme) - -For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/platform.js/wiki/Roadmap). - -## Support - -Platform.js has been tested in at least Chrome 5~27, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. - -## Installation and usage - -In a browser or Adobe AIR: - -```html - -``` - -Via [npm](http://npmjs.org/): - -```bash -npm install platform -``` - -In [Node.js](http://nodejs.org/) and [RingoJS](http://ringojs.org/): - -```js -var platform = require('platform'); -``` - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('platform.js'); -``` - -In an AMD loader like [RequireJS](http://requirejs.org/): - -```js -require({ - 'paths': { - 'platform': 'path/to/platform' - } -}, -['platform'], function(platform) { - console.log(platform.name); -}); -``` - -Usage example: - -```js -// on IE10 x86 platform preview running in IE7 compatibility mode on Windows 7 64 bit edition -platform.name; // 'IE' -platform.version; // '10.0' -platform.layout; // 'Trident' -platform.os; // 'Windows Server 2008 R2 / 7 x64' -platform.description; // 'IE 10.0 x86 (platform preview; running in IE 7 mode) on Windows Server 2008 R2 / 7 x64' - -// or on an iPad -platform.name; // 'Safari' -platform.version; // '5.1' -platform.product; // 'iPad' -platform.manufacturer; // 'Apple' -platform.layout; // 'WebKit' -platform.os; // 'iOS 5.0' -platform.description; // 'Safari 5.1 on Apple iPad (iOS 5.0)' - -// or parsing a given UA string -var info = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7.2; en; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 11.52'); -info.name; // 'Opera' -info.version; // '11.52' -info.layout; // 'Presto' -info.os; // 'Mac OS X 10.7.2' -info.description; // 'Opera 11.52 (identifying as Firefox 4.0) on Mac OS X 10.7.2' -``` - -## Author - -| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---| -| [John-David Dalton](http://allyoucanleet.com/) | - -## Contributors - -| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | -|---| -| [Mathias Bynens](http://mathiasbynens.be/) | diff --git a/vendor/platform.js/platform.js b/vendor/platform.js/platform.js index 30ce3e1c3..985e55b50 100644 --- a/vendor/platform.js/platform.js +++ b/vendor/platform.js/platform.js @@ -299,6 +299,7 @@ 'WebPositive', 'Opera Mini', 'Opera', + { 'label': 'Opera', 'pattern': 'OPR' }, 'Chrome', { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' }, { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' }, @@ -459,6 +460,7 @@ .replace(/Macintosh/, 'Mac OS') .replace(/_PowerPC/i, ' OS') .replace(/(OS X) [^ \d]+/i, '$1') + .replace(/Mac (OS X)/, '$1') .replace(/\/(\d)/, ' $1') .replace(/_/g, '.') .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '') @@ -555,7 +557,7 @@ } // detect Android browsers else if (manufacturer && manufacturer != 'Google' && - /Chrome|Vita/.test(name + ';' + product)) { + ((/Chrome/.test(name) && !/Mobile Safari/.test(ua)) || /Vita/.test(product))) { name = 'Android Browser'; os = /Android/.test(os) ? os : 'Android'; } @@ -575,7 +577,7 @@ // detect non-Opera versions (order is important) if (!version) { version = getVersion([ - '(?:Cloud9|CriOS|CrMo|Opera ?Mini|Raven|Silk(?!/[\\d.]+$))', + '(?:Cloud9|CriOS|CrMo|Opera ?Mini|OPR|Raven|Silk(?!/[\\d.]+$))', 'Version', qualify(name), '(?:Firefox|Minefield|NetFront)' @@ -585,9 +587,9 @@ if (layout == 'iCab' && parseFloat(version) > 3) { layout = ['WebKit']; } else if ((data = - /Opera/.test(name) && 'Presto' || + /Opera/.test(name) && (/OPR/.test(ua) ? 'Blink' : 'Presto') || /\b(?:Midori|Nook|Safari)\b/i.test(ua) && 'WebKit' || - !layout && /\bMSIE\b/i.test(ua) && (/^Mac/.test(os) ? 'Tasman' : 'Trident') + !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') )) { layout = [data]; } @@ -688,7 +690,7 @@ description.unshift('desktop mode'); } // add mobile postfix - else if ((name == 'IE' || name && !product && !/Browser|Mobi/.test(name)) && + else if ((name == 'Chrome' || name == 'IE' || name && !product && !/Browser|Mobi/.test(name)) && (os == 'Windows CE' || /Mobi/i.test(ua))) { name += ' Mobile'; } @@ -796,7 +798,7 @@ name = 'Chrome Mobile'; version = null; - if (/Mac OS X/.test(os)) { + if (/OS X/.test(os)) { manufacturer = 'Apple'; os = 'iOS 4.3+'; } else { diff --git a/vendor/qunit-clib/README.md b/vendor/qunit-clib/README.md deleted file mode 100644 index a8d2328e0..000000000 --- a/vendor/qunit-clib/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# QUnit CLIB v1.3.0 -## command-line interface boilerplate - -QUnit CLIB helps extend QUnit’s CLI support to many common CLI environments. - -## Screenshot - -![QUnit CLIB brings QUnit to your favorite shell.](http://i.imgur.com/jpu9l.png) - -## Support - -QUnit CLIB has been tested in at least Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. - -## Usage - -```js -;(function(window) { - 'use strict'; - - // use a single "load" function - var load = typeof require == 'function' ? require : window.load; - - // load QUnit and CLIB if needed - var QUnit = (function() { - var noop = Function.prototype; - return window.QUnit || ( - window.addEventListener || (window.addEventListener = noop), - window.setTimeout || (window.setTimeout = noop), - window.QUnit = load('../vendor/qunit/qunit/qunit.js') || window.QUnit, - (load('../vendor/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(window), - addEventListener === noop && delete window.addEventListener, - window.QUnit - ); - }()); - - // explicitly call `QUnit.module()` instead of `module()` - // in case we are in a CLI environment - QUnit.module('A Test Module'); - - test('A Test', function() { - // ... - }); - - // call `QUnit.start()` for Narwhal, Node.js, PhantomJS, Rhino, and RingoJS - if (!window.document || window.phantom) { - QUnit.start(); - } -}(typeof global == 'object' && global || this)); -``` - -## Footnotes - - 1. QUnit v1.3.0 does not work with Narwhal or Ringo < v0.8.0 - 2. Rhino v1.7RC4 does not support timeout fallbacks `clearTimeout` and `setTimeout` - -## Author - -| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---| -| [John-David Dalton](http://allyoucanleet.com/) | diff --git a/vendor/qunit/MIT-LICENSE.txt b/vendor/qunit/MIT-LICENSE.txt new file mode 100644 index 000000000..957f26d3e --- /dev/null +++ b/vendor/qunit/MIT-LICENSE.txt @@ -0,0 +1,21 @@ +Copyright 2013 jQuery Foundation and other contributors +http://jquery.com/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/qunit/README.md b/vendor/qunit/README.md deleted file mode 100644 index 6ab73f57a..000000000 --- a/vendor/qunit/README.md +++ /dev/null @@ -1,62 +0,0 @@ -[QUnit](http://qunitjs.com) - A JavaScript Unit Testing framework. -================================ - -QUnit is a powerful, easy-to-use, JavaScript test suite. It's used by the jQuery -project to test its code and plugins but is capable of testing any generic -JavaScript code (and even capable of testing JavaScript code on the server-side). - -QUnit is especially useful for regression testing: Whenever a bug is reported, -write a test that asserts the existence of that particular bug. Then fix it and -commit both. Every time you work on the code again, run the tests. If the bug -comes up again - a regression - you'll spot it immediately and know how to fix -it, because you know what code you just changed. - -Having good unit test coverage makes safe refactoring easy and cheap. You can -run the tests after each small refactoring step and always know what change -broke something. - -QUnit is similar to other unit testing frameworks like JUnit, but makes use of -the features JavaScript provides and helps with testing code in the browser, e.g. -with its stop/start facilities for testing asynchronous code. - -If you are interested in helping developing QUnit, you are in the right place. -For related discussions, visit the -[QUnit and Testing forum](http://forum.jquery.com/qunit-and-testing). - -Development ------------ - -To submit patches, fork the repository, create a branch for the change. Then implement -the change, run `grunt` to lint and test it, then commit, push and create a pull request. - -Include some background for the change in the commit message and `Fixes #nnn`, referring -to the issue number you're addressing. - -To run `grunt`, you need `node` and `npm`, then `npm install grunt -g`. That gives you a global -grunt binary. For additional grunt tasks, also run `npm install`. - -Releases --------- - -Install git-extras and run `git changelog` to update History.md. -Update qunit/qunit.js|css and package.json to the release version, commit and -tag, update them again to the next version, commit and push commits and tags -(`git push --tags origin master`). - -Put the 'v' in front of the tag, e.g. `v1.8.0`. Clean up the changelog, removing merge commits -or whitespace cleanups. - -To upload to code.jquery.com (replace $version accordingly), ssh to code.origin.jquery.com: - - cp qunit/qunit.js /var/www/html/code.jquery.com/qunit/qunit-$version.js - cp qunit/qunit.css /var/www/html/code.jquery.com/qunit/qunit-$version.css - -Then update /var/www/html/code.jquery.com/index.html and purge it with: - - curl -s http://code.origin.jquery.com/?reload - -Update web-base-template to link to those files for qunitjs.com. - -Publish to npm via - - npm publish diff --git a/vendor/qunit/qunit/qunit.css b/vendor/qunit/qunit/qunit.css index d7fc0c8ec..7ba3f9a30 100644 --- a/vendor/qunit/qunit/qunit.css +++ b/vendor/qunit/qunit/qunit.css @@ -1,5 +1,5 @@ /** - * QUnit v1.11.0 - A JavaScript Unit Testing Framework + * QUnit v1.12.0 - A JavaScript Unit Testing Framework * * http://qunitjs.com * diff --git a/vendor/qunit/qunit/qunit.js b/vendor/qunit/qunit/qunit.js index 302545f40..84c73907d 100644 --- a/vendor/qunit/qunit/qunit.js +++ b/vendor/qunit/qunit/qunit.js @@ -1,11 +1,11 @@ /** - * QUnit v1.11.0 - A JavaScript Unit Testing Framework + * QUnit v1.12.0 - A JavaScript Unit Testing Framework * * http://qunitjs.com * - * Copyright 2012 jQuery Foundation and other contributors + * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. - * http://jquery.org/license + * https://jquery.org/license/ */ (function( window ) { @@ -20,6 +20,7 @@ var QUnit, hasOwn = Object.prototype.hasOwnProperty, // Keep a local reference to Date (GH-283) Date = window.Date, + setTimeout = window.setTimeout, defined = { setTimeout: typeof window.setTimeout !== "undefined", sessionStorage: (function() { @@ -115,8 +116,16 @@ Test.prototype = { } }, setup: function() { - if ( this.module !== config.previousModule ) { - if ( config.previousModule ) { + if ( + // Emit moduleStart when we're switching from one module to another + this.module !== config.previousModule || + // They could be equal (both undefined) but if the previousModule property doesn't + // yet exist it means this is the first test in a suite that isn't wrapped in a + // module, in which case we'll just emit a moduleStart event for 'undefined'. + // Without this, reporters can get testStart before moduleStart which is a problem. + !hasOwn.call( config, "previousModule" ) + ) { + if ( hasOwn.call( config, "previousModule" ) ) { runLoggingCallbacks( "moduleDone", QUnit, { name: config.previousModule, failed: config.moduleStats.bad, @@ -129,10 +138,6 @@ Test.prototype = { runLoggingCallbacks( "moduleStart", QUnit, { name: this.module }); - } else if ( config.autorun ) { - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); } config.current = this; @@ -148,19 +153,27 @@ Test.prototype = { module: this.module }); - // allow utility functions to access the current test environment - // TODO why?? + /*jshint camelcase:false */ + + + /** + * Expose the current test environment. + * + * @deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead. + */ QUnit.current_testEnvironment = this.testEnvironment; + /*jshint camelcase:true */ + if ( !config.pollution ) { saveGlobal(); } if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment ); + this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); return; } try { - this.testEnvironment.setup.call( this.testEnvironment ); + this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); } catch( e ) { QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); } @@ -208,11 +221,11 @@ Test.prototype = { if ( typeof this.callbackRuntime === "undefined" ) { this.callbackRuntime = +new Date() - this.callbackStarted; } - this.testEnvironment.teardown.call( this.testEnvironment ); + this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); return; } else { try { - this.testEnvironment.teardown.call( this.testEnvironment ); + this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); } catch( e ) { QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); } @@ -419,7 +432,7 @@ QUnit = { test.queue(); }, - // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. + // Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through. expect: function( asserts ) { if (arguments.length === 1) { config.current.expected = asserts; @@ -454,7 +467,7 @@ QUnit = { } // A slight delay, to avoid any current callbacks if ( defined.setTimeout ) { - window.setTimeout(function() { + setTimeout(function() { if ( config.semaphore > 0 ) { return; } @@ -477,7 +490,7 @@ QUnit = { if ( config.testTimeout && defined.setTimeout ) { clearTimeout( config.timeout ); - config.timeout = window.setTimeout(function() { + config.timeout = setTimeout(function() { QUnit.ok( false, "Test timed out" ); config.semaphore = 1; QUnit.start(); @@ -487,7 +500,7 @@ QUnit = { }; // `assert` initialized at top of scope -// Asssert helpers +// Assert helpers // All of these must either call QUnit.push() or manually do: // - runLoggingCallbacks( "log", .. ); // - config.current.assertions.push({ .. }); @@ -505,6 +518,7 @@ assert = { throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); } result = !!result; + msg = msg || (result ? "okay" : "failed" ); var source, details = { @@ -514,8 +528,7 @@ assert = { message: msg }; - msg = escapeText( msg || (result ? "okay" : "failed" ) ); - msg = "" + msg + ""; + msg = "" + escapeText( msg ) + ""; if ( !result ) { source = sourceFromStacktrace( 2 ); @@ -642,13 +655,13 @@ assert = { QUnit.push( ok, actual, expectedOutput, message ); } else { - QUnit.pushFailure( message, null, 'No exception was thrown.' ); + QUnit.pushFailure( message, null, "No exception was thrown." ); } } }; /** - * @deprecate since 1.8.0 + * @deprecated since 1.8.0 * Kept assertion helpers in root for backwards compatibility. */ extend( QUnit, assert ); @@ -737,7 +750,7 @@ config = { // Export global variables, unless an 'exports' object exists, // in that case we assume we're in CommonJS (dealt with on the bottom of the script) if ( typeof exports === "undefined" ) { - extend( window, QUnit ); + extend( window, QUnit.constructor.prototype ); // Expose QUnit object window.QUnit = QUnit; @@ -836,6 +849,11 @@ extend( QUnit, { }, // Resets the test setup. Useful for tests that modify the DOM. + /* + DEPRECATED: Use multiple tests instead of resetting inside a test. + Use testStart or testDone for custom cleanup. + This method will throw an error in 2.0, and will be removed in 2.1 + */ reset: function() { var fixture = id( "qunit-fixture" ); if ( fixture ) { @@ -985,11 +1003,10 @@ extend( QUnit, { querystring = "?"; for ( key in params ) { - if ( !hasOwn.call( params, key ) ) { - continue; + if ( hasOwn.call( params, key ) ) { + querystring += encodeURIComponent( key ) + "=" + + encodeURIComponent( params[ key ] ) + "&"; } - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; } return window.location.protocol + "//" + window.location.host + window.location.pathname + querystring.slice( 0, -1 ); @@ -997,7 +1014,10 @@ extend( QUnit, { extend: extend, id: id, - addEvent: addEvent + addEvent: addEvent, + addClass: addClass, + hasClass: hasClass, + removeClass: removeClass // load, equiv, jsDump, diff: Attached later }); @@ -1044,6 +1064,7 @@ QUnit.load = function() { var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter, numModules = 0, + moduleNames = [], moduleFilterHtml = "", urlConfigHtml = "", oldconfig = extend( {}, config ); @@ -1072,18 +1093,24 @@ QUnit.load = function() { "'>"; } - + for ( i in config.modules ) { + if ( config.modules.hasOwnProperty( i ) ) { + moduleNames.push(i); + } + } + numModules = moduleNames.length; + moduleNames.sort( function( a, b ) { + return a.localeCompare( b ); + }); moduleFilterHtml += ""; @@ -1137,7 +1164,7 @@ QUnit.load = function() { // `label` initialized at top of scope label = document.createElement( "label" ); label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." ); + label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." ); label.innerHTML = "Hide passed tests"; toolbar.appendChild( label ); @@ -1157,14 +1184,19 @@ QUnit.load = function() { toolbar.appendChild( urlConfigCheckboxesContainer ); if (numModules > 1) { - moduleFilter = document.createElement( 'span' ); - moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); + moduleFilter = document.createElement( "span" ); + moduleFilter.setAttribute( "id", "qunit-modulefilter-container" ); moduleFilter.innerHTML = moduleFilterHtml; addEvent( moduleFilter.lastChild, "change", function() { var selectBox = moduleFilter.getElementsByTagName("select")[0], selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); + window.location = QUnit.url({ + module: ( selectedModule === "" ) ? undefined : selectedModule, + // Remove any existing filters + filter: undefined, + testNumber: undefined + }); }); toolbar.appendChild(moduleFilter); } @@ -1188,7 +1220,7 @@ addEvent( window, "load", QUnit.load ); onErrorFnPrev = window.onerror; // Cover uncaught exceptions -// Returning true will surpress the default browser handler, +// Returning true will suppress the default browser handler, // returning false will let it run. window.onerror = function ( error, filePath, linerNr ) { var ret = false; @@ -1197,7 +1229,7 @@ window.onerror = function ( error, filePath, linerNr ) { } // Treat return value as window.onerror itself does, - // Only do our handling if not surpressed. + // Only do our handling if not suppressed. if ( ret !== true ) { if ( QUnit.config.current ) { if ( QUnit.config.current.ignoreGlobalErrors ) { @@ -1227,6 +1259,7 @@ function done() { total: config.moduleStats.all }); } + delete config.previousModule; var i, key, banner = id( "qunit-banner" ), @@ -1386,16 +1419,16 @@ function escapeText( s ) { // Both single quotes and double quotes (for attributes) return s.replace( /['"<>&]/g, function( s ) { switch( s ) { - case '\'': - return '''; - case '"': - return '"'; - case '<': - return '<'; - case '>': - return '>'; - case '&': - return '&'; + case "'": + return "'"; + case "\"": + return """; + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; } }); } @@ -1419,7 +1452,7 @@ function process( last ) { if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { config.queue.shift()(); } else { - window.setTimeout( next, 13 ); + setTimeout( next, 13 ); break; } } @@ -1434,11 +1467,13 @@ function saveGlobal() { if ( config.noglobals ) { for ( var key in window ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { - continue; + if ( hasOwn.call( window, key ) ) { + // in Opera sometimes DOM element ids show up here, ignore them + if ( /^qunit-test-output/.test( key ) ) { + continue; + } + config.pollution.push( key ); } - config.pollution.push( key ); } } } @@ -1480,12 +1515,15 @@ function diff( a, b ) { function extend( a, b ) { for ( var prop in b ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - - // Avoid "Member not found" error in IE8 caused by setting window.constructor - } else if ( prop !== "constructor" || a !== window ) { - a[ prop ] = b[ prop ]; + if ( hasOwn.call( b, prop ) ) { + // Avoid "Member not found" error in IE8 caused by messing with window.constructor + if ( !( prop === "constructor" && a === window ) ) { + if ( b[ prop ] === undefined ) { + delete a[ prop ]; + } else { + a[ prop ] = b[ prop ]; + } + } } } @@ -1535,8 +1573,8 @@ function removeClass( elem, name ) { while ( set.indexOf(" " + name + " ") > -1 ) { set = set.replace(" " + name + " " , " "); } - // If possible, trim it for prettiness, but not neccecarily - elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); + // If possible, trim it for prettiness, but not necessarily + elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, ""); } function id( name ) { @@ -1585,8 +1623,10 @@ QUnit.equiv = (function() { callers = [], // stack to avoiding loops from circular referencing parents = [], + parentsB = [], getProto = Object.getPrototypeOf || function ( obj ) { + /*jshint camelcase:false */ return obj.__proto__; }, callbacks = (function () { @@ -1595,7 +1635,7 @@ QUnit.equiv = (function() { function useStrictEquality( b, a ) { /*jshint eqeqeq:false */ if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotaion VS 'new' annotation of a + // to catch short annotation VS 'new' annotation of a // declaration // e.g. var i = 1; // var j = new Number(1); @@ -1624,7 +1664,7 @@ QUnit.equiv = (function() { return QUnit.objectType( b ) === "regexp" && // the regex itself a.source === b.source && - // and its modifers + // and its modifiers a.global === b.global && // (gmi) ... a.ignoreCase === b.ignoreCase && @@ -1641,7 +1681,7 @@ QUnit.equiv = (function() { }, "array": function( b, a ) { - var i, j, len, loop; + var i, j, len, loop, aCircular, bCircular; // b could be an object literal here if ( QUnit.objectType( b ) !== "array" ) { @@ -1656,24 +1696,36 @@ QUnit.equiv = (function() { // track reference to avoid circular references parents.push( a ); + parentsB.push( b ); for ( i = 0; i < len; i++ ) { loop = false; for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - loop = true;// dont rewalk array + aCircular = parents[j] === a[i]; + bCircular = parentsB[j] === b[i]; + if ( aCircular || bCircular ) { + if ( a[i] === b[i] || aCircular && bCircular ) { + loop = true; + } else { + parents.pop(); + parentsB.pop(); + return false; + } } } if ( !loop && !innerEquiv(a[i], b[i]) ) { parents.pop(); + parentsB.pop(); return false; } } parents.pop(); + parentsB.pop(); return true; }, "object": function( b, a ) { - var i, j, loop, + /*jshint forin:false */ + var i, j, loop, aCircular, bCircular, // Default to true eq = true, aProperties = [], @@ -1692,28 +1744,36 @@ QUnit.equiv = (function() { // stack constructor before traversing properties callers.push( a.constructor ); + // track reference to avoid circular references parents.push( a ); + parentsB.push( b ); - for ( i in a ) { // be strict: don't ensures hasOwnProperty - // and go deep + // be strict: don't ensure hasOwnProperty and go deep + for ( i in a ) { loop = false; for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - // don't go down the same path twice - loop = true; + aCircular = parents[j] === a[i]; + bCircular = parentsB[j] === b[i]; + if ( aCircular || bCircular ) { + if ( a[i] === b[i] || aCircular && bCircular ) { + loop = true; + } else { + eq = false; + break; + } } } - aProperties.push(i); // collect a's properties - - if (!loop && !innerEquiv( a[i], b[i] ) ) { + aProperties.push(i); + if ( !loop && !innerEquiv(a[i], b[i]) ) { eq = false; break; } } - callers.pop(); // unstack, we are done parents.pop(); + parentsB.pop(); + callers.pop(); // unstack, we are done for ( i in b ) { bProperties.push( i ); // collect b's properties @@ -1743,7 +1803,7 @@ QUnit.equiv = (function() { } // apply transition with (1..n) arguments - }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); + }( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) ); }; return innerEquiv; @@ -1761,7 +1821,7 @@ QUnit.equiv = (function() { */ QUnit.jsDump = (function() { function quote( str ) { - return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; + return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\""; } function literal( o ) { return o + ""; @@ -1854,13 +1914,13 @@ QUnit.jsDump = (function() { if ( this.HTML ) { chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); } - return new Array( this._depth_ + (extra||0) ).join(chr); + return new Array( this.depth + ( extra || 0 ) ).join(chr); }, up: function( a ) { - this._depth_ += a || 1; + this.depth += a || 1; }, down: function( a ) { - this._depth_ -= a || 1; + this.depth -= a || 1; }, setParser: function( name, parser ) { this.parsers[name] = parser; @@ -1870,7 +1930,7 @@ QUnit.jsDump = (function() { literal: literal, join: join, // - _depth_: 1, + depth: 1, // This is the list of parsers, to modify them, use jsDump.setParser parsers: { window: "[Window]", @@ -1898,6 +1958,7 @@ QUnit.jsDump = (function() { nodelist: array, "arguments": array, object: function( map, stack ) { + /*jshint forin:false */ var ret = [ ], keys, key, val, i; QUnit.jsDump.up(); keys = []; @@ -2036,18 +2097,17 @@ QUnit.diff = (function() { } for ( i in ns ) { - if ( !hasOwn.call( ns, i ) ) { - continue; - } - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; + if ( hasOwn.call( ns, i ) ) { + if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { + n[ ns[i].rows[0] ] = { + text: n[ ns[i].rows[0] ], + row: os[i].rows[0] + }; + o[ os[i].rows[0] ] = { + text: o[ os[i].rows[0] ], + row: ns[i].rows[0] + }; + } } } @@ -2143,9 +2203,9 @@ QUnit.diff = (function() { }; }()); -// for CommonJS enviroments, export everything +// for CommonJS environments, export everything if ( typeof exports !== "undefined" ) { - extend( exports, QUnit ); + extend( exports, QUnit.constructor.prototype ); } // get at whatever the global object is, like window in browsers diff --git a/vendor/requirejs/README.md b/vendor/requirejs/README.md deleted file mode 100644 index 4d3f25e37..000000000 --- a/vendor/requirejs/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# RequireJS - -RequireJS loads plain JavaScript files as well as more defined modules. It is -optimized for in-browser use, including in -[a Web Worker](http://requirejs.org/docs/api.html#webworker), but it can be used -in other JavaScript environments, like Rhino and -[Node](http://requirejs.org/docs/node.html). It implements the -[Asynchronous Module](https://github.com/amdjs/amdjs-api/wiki/AMD) -API. - -RequireJS uses plain script tags to load modules/files, so it should allow for -easy debugging. It can be used -[simply to load existing JavaScript files](http://requirejs.org/docs/api.html#jsfiles), -so you can add it to your existing project without having to re-write your -JavaScript files. - -RequireJS includes [an optimization tool](http://requirejs.org/docs/optimization.html) -you can run as part of your packaging steps for deploying your code. The -optimization tool can combine and minify your JavaScript files to allow for -better performance. - -If the JavaScript file defines a JavaScript module via -[define()](http://requirejs.org/docs/api.html#define), then there are other benefits -RequireJS can offer: [improvements over traditional CommonJS modules](http://requirejs.org/docs/commonjs.html) -and [loading multiple versions](http://requirejs.org/docs/api.html#multiversion) -of a module in a page. RequireJS also has a plugin system that supports features like -[i18n string bundles](http://requirejs.org/docs/api.html#i18n), and -[text file dependencies](http://requirejs.org/docs/api.html#text). - -RequireJS does not have any dependencies on a JavaScript framework. -It is dual-licensed -- new BSD or MIT. - -The standard require.js file is around 5.5KB when minified via Closure Compiler -and gzipped. - -RequireJS works in IE 6+, Firefox 2+, Safari 3.2+, Chrome 3+, and Opera 10+. - -[Latest Release](http://requirejs.org/docs/download.html) - -## Directories - -* **dist**: Scripts and assets to generate the requirejs.org docs, and for -generating a require.js release. -* **docs**: The raw HTML files for the requirejs.org docs. Only includes the -body of each page. Files in **dist** are used to generate a complete HTML page. -* **tests**: Tests for require.js. -* **testBaseUrl.js**: A file used in the tests inside **tests**. Purposely -placed outside the tests directory for testing paths that go outside a baseUrl. -* **updatesubs.sh**: Updates projects that depend on require.js Assumes the -projects are siblings to this directory and have specific names. Useful to -copy require.js to dependent projects easily while in development. diff --git a/vendor/underscore/README.md b/vendor/underscore/README.md deleted file mode 100644 index b1f3e50a8..000000000 --- a/vendor/underscore/README.md +++ /dev/null @@ -1,19 +0,0 @@ - __ - /\ \ __ - __ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____ - /\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\ - \ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\ - \ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/ - \/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/ - \ \____/ - \/___/ - -Underscore.js is a utility-belt library for JavaScript that provides -support for the usual functional suspects (each, map, reduce, filter...) -without extending any core JavaScript objects. - -For Docs, License, Tests, and pre-packed downloads, see: -http://underscorejs.org - -Many thanks to our contributors: -https://github.com/documentcloud/underscore/contributors