mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-14 04:37:50 +00:00
0.4.3, with fixed export for CommonJS and StopIteration support
This commit is contained in:
12
index.html
12
index.html
@@ -107,11 +107,11 @@
|
|||||||
<p>
|
<p>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="underscore.js">Development Version (0.4.2)</a></td>
|
<td><a href="underscore.js">Development Version (0.4.3)</a></td>
|
||||||
<td><i>18kb, Uncompressed with Comments</i></td>
|
<td><i>18kb, Uncompressed with Comments</i></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="underscore-min.js">Production Version (0.4.2)</a></td>
|
<td><a href="underscore-min.js">Production Version (0.4.3)</a></td>
|
||||||
<td><i>2kb, Packed and Gzipped</i></td>
|
<td><i>2kb, Packed and Gzipped</i></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -804,6 +804,8 @@ moe === _.identity(moe);
|
|||||||
<br />
|
<br />
|
||||||
Breaks out of the current loop iteration. Similar to the <tt>break</tt>
|
Breaks out of the current loop iteration. Similar to the <tt>break</tt>
|
||||||
keyword in regular "for" loop, but works within an iterator function.
|
keyword in regular "for" loop, but works within an iterator function.
|
||||||
|
Uses the native <tt>StopIteration</tt> object in JavaScript 1.7 compliant
|
||||||
|
browsers.
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
var result = null;
|
var result = null;
|
||||||
@@ -889,6 +891,12 @@ _([1, 2, 3]).value();
|
|||||||
|
|
||||||
<h2>Change Log</h2>
|
<h2>Change Log</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b class="header">0.4.3</b><br />
|
||||||
|
Started using the native StopIteration object in browsers that support it.
|
||||||
|
Fixed Underscore setup for CommonJS environments.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b class="header">0.4.2</b><br />
|
<b class="header">0.4.2</b><br />
|
||||||
Renamed the unwrapping function to <tt>value</tt>, for clarity.
|
Renamed the unwrapping function to <tt>value</tt>, for clarity.
|
||||||
|
|||||||
2
underscore-min.js
vendored
2
underscore-min.js
vendored
File diff suppressed because one or more lines are too long
@@ -21,19 +21,17 @@
|
|||||||
// underscore functions. Wrapped objects may be chained.
|
// underscore functions. Wrapped objects may be chained.
|
||||||
var wrapper = function(obj) { this._wrapped = obj; };
|
var wrapper = function(obj) { this._wrapped = obj; };
|
||||||
|
|
||||||
|
// Establish the object that gets thrown to break out of a loop iteration.
|
||||||
|
var breaker = typeof StopIteration !== 'undefined' ? StopIteration : '__break__';
|
||||||
|
|
||||||
// Create a safe reference to the Underscore object for reference below.
|
// Create a safe reference to the Underscore object for reference below.
|
||||||
var _ = root._ = function(obj) { return new wrapper(obj); };
|
var _ = root._ = function(obj) { return new wrapper(obj); };
|
||||||
|
|
||||||
// Export the Underscore object for CommonJS.
|
// Export the Underscore object for CommonJS.
|
||||||
if (module && typeof module.exports !== 'undefined') {
|
if (typeof exports !== 'undefined') exports._ = _;
|
||||||
// richer binding for systems that allow it (node.js for example)
|
|
||||||
module.exports = _;
|
|
||||||
} else {
|
|
||||||
if (typeof exports !== 'undefined') _ = exports;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Current version.
|
// Current version.
|
||||||
_.VERSION = '0.4.2';
|
_.VERSION = '0.4.3';
|
||||||
|
|
||||||
/*------------------------ Collection Functions: ---------------------------*/
|
/*------------------------ Collection Functions: ---------------------------*/
|
||||||
|
|
||||||
@@ -52,7 +50,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
if (e != '__break__') throw e;
|
if (e != breaker) throw e;
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
@@ -453,7 +451,7 @@
|
|||||||
|
|
||||||
// Break out of the middle of an iteration.
|
// Break out of the middle of an iteration.
|
||||||
_.breakLoop = function() {
|
_.breakLoop = function() {
|
||||||
throw "__break__";
|
throw breaker;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Generate a unique integer id (unique within the entire client session).
|
// Generate a unique integer id (unique within the entire client session).
|
||||||
|
|||||||
Reference in New Issue
Block a user