Skip to content

Commit 06c9916

Browse files
committed
Merge branch 'master' into gh-pages
2 parents 3d08a0a + 19db749 commit 06c9916

16 files changed

+1298
-263
lines changed

.travis.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
language: node_js
2-
addons:
3-
firefox: "10.0"
42
node_js:
53
- "0.8"
64
- "0.12"
@@ -9,15 +7,26 @@ matrix:
97
include:
108
- node_js: "0.10"
119
env: BROWSER=true
12-
env: BROWSER=false
1310
before_install:
1411
- npm install -g npm
15-
- if [[ $BROWSER == true ]]; then npm install karma-phantomjs-launcher karma-firefox-launcher; fi
12+
- npm install -g karma-cli
1613
before_script:
14+
- npm install karma-sauce-launcher
1715
- export DISPLAY=:99.0
1816
- sh -e /etc/init.d/xvfb start
1917
script:
2018
- npm test
21-
- "[ $BROWSER == false ] || ./node_modules/karma/bin/karma start --browsers Firefox,PhantomJS"
19+
- "[ $BROWSER == false ] || npm run test-browser"
20+
# Karma sauce is limited to running about 5-7 browsers (or it will tiemout) at a time so we just run vendor by vendor here
21+
- "[ $BROWSER == false ] || karma start karma.conf-sauce.js --browsers FIREFOX_V4,FIREFOX_V11,FIREFOX_V20,FIREFOX_V30,FIREFOX_V35"
22+
- "[ $BROWSER == false ] || karma start karma.conf-sauce.js --browsers CHROME_V28,CHROME_V35,CHROME_V40,ANDROID_V4.0,ANDROID_V4.3"
23+
- "[ $BROWSER == false ] || karma start karma.conf-sauce.js --browsers INTERNET_EXPLORER_V9,INTERNET_EXPLORER_V10,INTERNET_EXPLORER_V11"
24+
- "[ $BROWSER == false ] || karma start karma.conf-sauce.js --browsers SAFARI_V5,SAFARI_V6,SAFARI_V7"
25+
- "[ $BROWSER == false ] || karma start karma.conf-sauce.js --browsers OPERA_V11,OPERA_V12"
2226
notifications:
2327
email: false
28+
env:
29+
global:
30+
- secure: bDZSBQfqr21hCayjcZ20IxrV6+XGhxQPFIfwWqEKLrF93Gu8LLVjZRxXE/mE8I8N4Z5WtDNb4ZHrm/TTzmcPa5MuHgIxEdknQCncobH8oimwc83SHwEPk6okeNKl39VlCjvvnmoe/V/KpnknuYn3Rqghtl/Uv9KLpCwskwjTtcw=
31+
- secure: SRECgXuwcZTcD3GVxTS2bYNgRyye4vq6BLrV2PH9FyNenowsKQR2EwlC/dppc1Q8NWMgv79J/R96q9JOFh+mEH9L5dlBb2yhnGH8amVeM/ChAJHT/F8YktKM453uVpz5fR00QcCQDDUOx6Pvx374ID0OKNpWKAkQBWA9mPTsLnE=
32+
matrix: BROWSER=false

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "underscore",
3-
"version": "1.8.1",
3+
"version": "1.8.2",
44
"main": "underscore.js",
55
"keywords": ["util", "functional", "server", "client", "browser"],
66
"ignore" : ["docs", "test", "*.yml", "CNAME", "index.html", "favicon.ico", "CONTRIBUTING.md"]

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"repo" : "jashkenas/underscore",
66
"main" : "underscore.js",
77
"scripts" : ["underscore.js"],
8-
"version" : "1.8.1",
8+
"version" : "1.8.2",
99
"license" : "MIT"
1010
}

docs/underscore.html

Lines changed: 270 additions & 197 deletions
Large diffs are not rendered by default.

index.html

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
<div id="sidebar" class="interface">
181181

182182
<a class="toc_title" href="#">
183-
Underscore.js <span class="version">(1.8.1)</span>
183+
Underscore.js <span class="version">(1.8.2)</span>
184184
</a>
185185
<ul class="toc_section">
186186
<li>&raquo; <a href="https://github.com/jashkenas/underscore">GitHub Repository</a></li>
@@ -282,7 +282,7 @@
282282
<li>- <a href="#object-functions">functions</a></li>
283283
<li>- <a href="#findKey">findKey</a></li>
284284
<li>- <a href="#extend">extend</a></li>
285-
<li>- <a href="#assign">assign</a></li>
285+
<li>- <a href="#extendOwn">extendOwn</a></li>
286286
<li>- <a href="#create">create</a></li>
287287
<li>- <a href="#pick">pick</a></li>
288288
<li>- <a href="#omit">omit</a></li>
@@ -403,13 +403,13 @@ <h2>Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and u
403403

404404
<table>
405405
<tr>
406-
<td><a href="underscore.js">Development Version (1.8.1)</a></td>
407-
<td><i>49kb, Uncompressed with Plentiful Comments</i></td>
406+
<td><a href="underscore.js">Development Version (1.8.2)</a></td>
407+
<td><i>51kb, Uncompressed with Plentiful Comments</i></td>
408408
</tr>
409409
<tr>
410-
<td><a href="underscore-min.js">Production Version (1.8.1)</a></td>
410+
<td><a href="underscore-min.js">Production Version (1.8.2)</a></td>
411411
<td>
412-
<i>5.4kb, Minified and Gzipped</i>
412+
<i>5.7kb, Minified and Gzipped</i>
413413
&nbsp;<small>(<a href="underscore-min.map">Source Map</a>)</small>
414414
</td>
415415
</tr>
@@ -619,11 +619,12 @@ <h2 id="collections">Collection Functions (Arrays or Objects)</h2>
619619
</pre>
620620

621621
<p id="contains">
622-
<b class="header">contains</b><code>_.contains(list, value)</code>
623-
<span class="alias">Alias: <b>include</b></span>
622+
<b class="header">contains</b><code>_.contains(list, value, [fromIndex])</code>
623+
<span class="alias">Alias: <b>includes</b></span>
624624
<br />
625625
Returns <i>true</i> if the <b>value</b> is present in the <b>list</b>.
626-
Uses <b>indexOf</b> internally, if <b>list</b> is an Array.
626+
Uses <b>indexOf</b> internally, if <b>list</b> is an Array.
627+
Use <b>fromIndex</b> to start your search at a given index.
627628
</p>
628629
<pre>
629630
_.contains([1, 2, 3], 3);
@@ -1378,7 +1379,7 @@ <h2 id="objects">Object Functions</h2>
13781379
_.mapObject({start: 5, end: 12}, function(val, key) {
13791380
return val + 5;
13801381
});
1381-
=&gt; {start: 10, b: 17}
1382+
=&gt; {start: 10, end: 17}
13821383
</pre>
13831384

13841385
<p id="pairs">
@@ -1438,6 +1439,7 @@ <h2 id="objects">Object Functions</h2>
14381439

14391440
<p id="extendOwn">
14401441
<b class="header">extendOwn</b><code>_.extendOwn(destination, *sources)</code>
1442+
<span class="alias">Alias: <b>assign</b></span>
14411443
<br />
14421444
Like <b>extend</b>, but only copies <i>own</i> properties over to the
14431445
destination object.
@@ -2191,13 +2193,26 @@ <h2 id="links">Links &amp; Suggested Reading</h2>
21912193

21922194
<h2 id="changelog">Change Log</h2>
21932195

2196+
<p id="1.8.2">
2197+
<b class="header">1.8.2</b> &mdash; <small><i>Feb. 22, 2015</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.8.1...1.8.2">Diff</a> &mdash; <a href="https://cdn.rawgit.com/jashkenas/underscore/1.8.2/index.html">Docs</a><br />
2198+
<ul>
2199+
<li>
2200+
Restores the previous old-Internet-Explorer edge cases changed in
2201+
1.8.1.
2202+
</li>
2203+
<li>
2204+
Adds a <tt>fromIndex</tt> argument to <tt>_.contains</tt>.
2205+
</li>
2206+
</ul>
2207+
</p>
2208+
21942209
<p id="1.8.1">
21952210
<b class="header">1.8.1</b> &mdash; <small><i>Feb. 19, 2015</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.8.0...1.8.1">Diff</a> &mdash; <a href="https://cdn.rawgit.com/jashkenas/underscore/1.8.1/index.html">Docs</a><br />
21962211
<ul>
21972212
<li>
2198-
Fixes/changes some old-Internet-Explorer and related edge case
2213+
Fixes/changes some old-Internet Explorer and related edge case
21992214
behavior. Test your app with Underscore 1.8.1 in an old IE and let
2200-
us know how its doing...
2215+
us know how it's doing...
22012216
</li>
22022217
</ul>
22032218
</p>

karma.conf-sauce.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
var _ = require('./');
2+
3+
// Browsers to run on Sauce Labs platforms
4+
var sauceBrowsers = _.reduce([
5+
['firefox', '35'],
6+
['firefox', '30'],
7+
['firefox', '20'],
8+
['firefox', '11'],
9+
['firefox', '4'],
10+
11+
['chrome', '40'],
12+
['chrome', '35'],
13+
['chrome', '28'],
14+
15+
['internet explorer', '11', 'Windows 8.1'],
16+
['internet explorer', '10', 'Windows 8'],
17+
['internet explorer', '9', 'Windows 7'],
18+
// Currently do not work with Karma.
19+
// ['internet explorer', '8', 'Windows 7'],
20+
// ['internet explorer', '7', 'Windows XP'],
21+
// ['internet explorer', '6', 'Windows XP'],
22+
23+
['opera', '12'],
24+
['opera', '11'],
25+
26+
['android', '4.3'],
27+
['android', '4.0'],
28+
29+
['safari', '8'],
30+
['safari', '6'],
31+
['safari', '7'],
32+
['safari', '5']
33+
], function(memo, platform) {
34+
var label = (platform[0] + '_v' + platform[1]).replace(' ', '_').toUpperCase();
35+
memo[label] = _.pick({
36+
'base': 'SauceLabs',
37+
'browserName': platform[0],
38+
'version': platform[1],
39+
'platform': platform[2]
40+
}, Boolean);
41+
return memo;
42+
}, {});
43+
44+
module.exports = function(config) {
45+
if ( !process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY ) {
46+
console.log('Sauce environments not set --- Skipping');
47+
return process.exit(0);
48+
}
49+
50+
config.set({
51+
basePath: '',
52+
frameworks: ['qunit'],
53+
singleRun: true,
54+
55+
// list of files / patterns to load in the browser
56+
files: [
57+
'test/vendor/qunit-extras.js',
58+
'underscore.js',
59+
'test/*.js'
60+
],
61+
// test results reporter to use
62+
reporters: ['dots', 'saucelabs'],
63+
port: 9876,
64+
colors: true,
65+
logLevel: config.LOG_INFO,
66+
sauceLabs: {
67+
build: 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')',
68+
startConnect: true,
69+
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
70+
},
71+
72+
// TODO(vojta): remove once SauceLabs supports websockets.
73+
// This speeds up the capturing a bit, as browsers don't even try to use websocket.
74+
transports: ['xhr-polling'],
75+
captureTimeout: 120000,
76+
customLaunchers: sauceBrowsers
77+
78+
// Browsers to launch, commented out to prevent karma from starting
79+
// too many concurrent browsers and timing sauce out.
80+
// browsers: _.keys(sauceBrowsers)
81+
});
82+
};

karma.conf.js

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
// Note some browser launchers should be installed before using karma start.
2+
23
// For example:
3-
// npm install karma-firefox-launcher
4-
// karma start --browser=Firefox
4+
// $ npm install karma-firefox-launcher
5+
// $ karma start --browser=Firefox
6+
7+
// See http://karma-runner.github.io/0.8/config/configuration-file.html
58
module.exports = function(config) {
69
config.set({
710
basePath: '',
811
frameworks: ['qunit'],
12+
logLevel: config.LOG_INFO,
13+
port: 9876,
914

1015
// list of files / patterns to load in the browser
1116
files: [
17+
'test/vendor/qunit-extras.js',
1218
'underscore.js',
1319
'test/*.js'
1420
],
1521

16-
// test results reporter to use
17-
// possible values: 'dots', 'progress'
18-
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
22+
// Test results reporter to use
23+
// https://npmjs.org/browse/keyword/karma-reporter
1924
reporters: ['progress'],
2025

21-
// web server port
22-
port: 9876,
23-
24-
// enable / disable colors in the output (reporters and logs)
25-
colors: true,
26-
27-
// level of logging
28-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
29-
logLevel: config.LOG_INFO,
30-
31-
// enable / disable watching file and executing tests whenever any file changes
32-
autoWatch: false,
33-
3426
// start these browsers
3527
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
3628
browsers: ['PhantomJS'],

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"url": "git://github.com/jashkenas/underscore.git"
1616
},
1717
"main": "underscore.js",
18-
"version": "1.8.1",
18+
"version": "1.8.2",
1919
"devDependencies": {
20-
"docco": "0.6.x",
20+
"docco": "*",
2121
"eslint": "0.6.x",
2222
"karma": "~0.12.31",
2323
"karma-qunit": "~0.1.4",

test/collections.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,14 @@
418418

419419
test('contains', function() {
420420
strictEqual(_.includes, _.contains, 'alias for includes');
421+
422+
var numbers = [1, 2, 3, 1, 2, 3, 1, 2, 3];
423+
strictEqual(_.includes(numbers, 1, 1), true);
424+
strictEqual(_.includes(numbers, 1, -1), false);
425+
strictEqual(_.includes(numbers, 1, -2), false);
426+
strictEqual(_.includes(numbers, 1, -3), true);
427+
strictEqual(_.includes(numbers, 1, 6), true);
428+
strictEqual(_.includes(numbers, 1, 7), false);
421429
});
422430

423431
test('includes with NaN', function() {

test/functions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
var _ = typeof require == 'function' ? require('..') : window._;
33

44
QUnit.module('Functions');
5+
QUnit.config.asyncRetries = 3;
56

67
test('bind', function() {
78
var context = {name : 'moe'};

0 commit comments

Comments
 (0)