0.0.2 • Published 7 years ago
@lvchengbin/set v0.0.2
Set
An implementation of Set in JavaScript for browsers, supporting methods of Set in ES6.
Usage
$ npm i @lvchengbin/set --saveimport Set from '@lvchengbin/set';
const set = new Set( [ 'a', 'b', '1', '2', 1, 2 ] );
set.set( 3 );The Set constructor has two argument, the first argument should be an Array and the second one should be a Boolean and be used to denote if to use the native Set or not if the client supports the native Set class, using true by default.
If you want to use the library in browsers that loading with <SCRIPT> tag, you can git it from set.js, and for browsers do not support ES6, please use set.bc.js.
<script src="./set.bc.js"></script>
<script>
var set = new Set( [ [ 'x', 1 ], [ 'y', 2 ] ] );
console.log( set.size );
</script>