node/tools/eslint/node_modules/es6-set
Rich Trott d7aa8fa088 tools: update ESLint to version 2.1.0
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>
2016-02-18 10:13:13 -08:00
..
ext tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
lib tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
primitive tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
test tools: update ESLint to version 2.1.0 2016-02-18 10:13:13 -08:00
.lint tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
.npmignore tools: update ESLint to version 2.1.0 2016-02-18 10:13:13 -08:00
.travis.yml tools: update ESLint to version 2.1.0 2016-02-18 10:13:13 -08:00
CHANGES tools: update ESLint to version 2.1.0 2016-02-18 10:13:13 -08:00
implement.js tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
index.js tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
is-implemented.js tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
is-native-implemented.js tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
is-set.js tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
LICENSE tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
package.json tools: update ESLint to version 2.1.0 2016-02-18 10:13:13 -08:00
polyfill.js tools: update ESLint to version 2.1.0 2016-02-18 10:13:13 -08:00
README.md tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00
valid-set.js tools: update eslint to v1.10.3 2016-01-13 23:15:39 +01:00

es6-set

Set collection as specified in ECMAScript6

Usage

If you want to make sure your environment implements Set, do:

require('es6-set/implement');

If you'd like to use native version when it exists and fallback to polyfill if it doesn't, but without implementing Set on global scope, do:

var Set = require('es6-set');

If you strictly want to use polyfill even if native Set exists, do:

var Set = require('es6-set/polyfill');

Installation

$ npm install es6-set

To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: Browserify, Webmake or Webpack

API

Best is to refer to specification. Still if you want quick look, follow examples:

var Set = require('es6-set');

var set = new Set(['raz', 'dwa', {}]);

set.size;          // 3
set.has('raz');    // true
set.has('foo');    // false
set.add('foo');    // set
set.size           // 4
set.has('foo');    // true
set.has('dwa');    // true
set.delete('dwa'); // true
set.size;          // 3

set.forEach(function (value) {
 // 'raz', {}, 'foo' iterated
});

// FF nightly only:
for (value of set) {
 // 'raz', {}, 'foo' iterated
}

var iterator = set.values();

iterator.next(); // { done: false, value: 'raz' }
iterator.next(); // { done: false, value: {} }
iterator.next(); // { done: false, value: 'foo' }
iterator.next(); // { done: true, value: undefined }

set.clear(); // undefined
set.size; // 0

Tests Build Status

$ npm test