mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Update ESLint to 2.1.0. ESLint has a number of potentially-useful new features but this change attempts to be minimal in its changes. However, some things could not be avoided reasonably. ESLint 2.1.0 found a few lint issues that ESLing 1.x missed with template strings that did not take advantage of any features of template strings, and `let` declarations where `const` sufficed. Additionally, ESLint 2.1.0 removes some granularity around enabling ES6 features. Some features (e.g., spread operator) that had been turned off in our configuration for ESLint 1.x are now permitted. PR-URL: https://github.com/nodejs/node/pull/5214 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Myles Borins <myles.borins@gmail.com>
68 lines
2.5 KiB
JavaScript
68 lines
2.5 KiB
JavaScript
'use strict';
|
|
|
|
var iteratorSymbol = require('es6-symbol').iterator;
|
|
|
|
module.exports = function (T) {
|
|
return {
|
|
Values: function (a) {
|
|
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it;
|
|
|
|
it = new T(x);
|
|
a(it[iteratorSymbol](), it, "@@iterator");
|
|
a.deep(it.next(), { done: false, value: 'raz' }, "#1");
|
|
a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
|
|
x.splice(1, 0, 'elo');
|
|
a.deep(it.next(), { done: false, value: 'dwa' }, "Insert");
|
|
a.deep(it.next(), { done: false, value: 'trzy' }, "#3");
|
|
a.deep(it.next(), { done: false, value: 'cztery' }, "#4");
|
|
x.pop();
|
|
a.deep(it.next(), { done: false, value: 'pięć' }, "#5");
|
|
a.deep(it.next(), { done: true, value: undefined }, "End");
|
|
},
|
|
"Keys & Values": function (a) {
|
|
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it;
|
|
|
|
it = new T(x, 'key+value');
|
|
a(it[iteratorSymbol](), it, "@@iterator");
|
|
a.deep(it.next(), { done: false, value: [0, 'raz'] }, "#1");
|
|
a.deep(it.next(), { done: false, value: [1, 'dwa'] }, "#2");
|
|
x.splice(1, 0, 'elo');
|
|
a.deep(it.next(), { done: false, value: [2, 'dwa'] }, "Insert");
|
|
a.deep(it.next(), { done: false, value: [3, 'trzy'] }, "#3");
|
|
a.deep(it.next(), { done: false, value: [4, 'cztery'] }, "#4");
|
|
x.pop();
|
|
a.deep(it.next(), { done: false, value: [5, 'pięć'] }, "#5");
|
|
a.deep(it.next(), { done: true, value: undefined }, "End");
|
|
},
|
|
Keys: function (a) {
|
|
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it;
|
|
|
|
it = new T(x, 'key');
|
|
a(it[iteratorSymbol](), it, "@@iterator");
|
|
a.deep(it.next(), { done: false, value: 0 }, "#1");
|
|
a.deep(it.next(), { done: false, value: 1 }, "#2");
|
|
x.splice(1, 0, 'elo');
|
|
a.deep(it.next(), { done: false, value: 2 }, "Insert");
|
|
a.deep(it.next(), { done: false, value: 3 }, "#3");
|
|
a.deep(it.next(), { done: false, value: 4 }, "#4");
|
|
x.pop();
|
|
a.deep(it.next(), { done: false, value: 5 }, "#5");
|
|
a.deep(it.next(), { done: true, value: undefined }, "End");
|
|
},
|
|
Sparse: function (a) {
|
|
var x = new Array(6), it;
|
|
|
|
x[2] = 'raz';
|
|
x[4] = 'dwa';
|
|
it = new T(x);
|
|
a.deep(it.next(), { done: false, value: undefined }, "#1");
|
|
a.deep(it.next(), { done: false, value: undefined }, "#2");
|
|
a.deep(it.next(), { done: false, value: 'raz' }, "#3");
|
|
a.deep(it.next(), { done: false, value: undefined }, "#4");
|
|
a.deep(it.next(), { done: false, value: 'dwa' }, "#5");
|
|
a.deep(it.next(), { done: false, value: undefined }, "#6");
|
|
a.deep(it.next(), { done: true, value: undefined }, "End");
|
|
}
|
|
};
|
|
};
|