Comparing version 0.1.1 to 0.1.2
@@ -6,2 +6,3 @@ 'use strict'; | ||
if (typeof Set !== 'function') return false; | ||
if (String(Set.prototype) !== '[object Set]') return false; | ||
set = new Set(['raz', 'dwa', 'trzy']); | ||
@@ -22,3 +23,4 @@ if (set.size !== 3) return false; | ||
if (result.value !== 'raz') return false; | ||
return true; | ||
}; |
@@ -30,3 +30,2 @@ 'use strict'; | ||
}); | ||
defineProperty(SetIterator.prototype, toStringTagSymbol, | ||
d('c', 'Set Iterator')); | ||
defineProperty(SetIterator.prototype, toStringTagSymbol, d('c', 'Set Iterator')); |
{ | ||
"name": "es6-set", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "ECMAScript6 Set polyfill", | ||
@@ -20,11 +20,11 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)", | ||
"d": "~0.1.1", | ||
"es5-ext": "~0.10.4", | ||
"es6-iterator": "~0.1.1", | ||
"es6-symbol": "~0.1.1", | ||
"event-emitter": "~0.3.1" | ||
"es5-ext": "~0.10.8", | ||
"es6-iterator": "2", | ||
"es6-symbol": "3", | ||
"event-emitter": "~0.3.4" | ||
}, | ||
"devDependencies": { | ||
"tad": "0.2.x", | ||
"xlint": "~0.2.1", | ||
"xlint-jslint-medikoo": "~0.1.2" | ||
"tad": "~0.2.3", | ||
"xlint": "~0.2.2", | ||
"xlint-jslint-medikoo": "~0.1.4" | ||
}, | ||
@@ -31,0 +31,0 @@ "scripts": { |
@@ -15,18 +15,19 @@ 'use strict'; | ||
, call = Function.prototype.call, defineProperty = Object.defineProperty | ||
, call = Function.prototype.call | ||
, defineProperty = Object.defineProperty, getPrototypeOf = Object.getPrototypeOf | ||
, SetPoly, getValues; | ||
module.exports = SetPoly = function (/*iterable*/) { | ||
var iterable = arguments[0]; | ||
if (!(this instanceof SetPoly)) return new SetPoly(iterable); | ||
if (this.__setData__ !== undefined) { | ||
throw new TypeError(this + " cannot be reinitialized"); | ||
} | ||
var iterable = arguments[0], self; | ||
if (!(this instanceof SetPoly)) throw new TypeError('Constructor requires \'new\''); | ||
if (isNative && setPrototypeOf) self = setPrototypeOf(new Set(), getPrototypeOf(this)); | ||
else self = this; | ||
if (iterable != null) iterator(iterable); | ||
defineProperty(this, '__setData__', d('c', [])); | ||
if (!iterable) return; | ||
defineProperty(self, '__setData__', d('c', [])); | ||
if (!iterable) return self; | ||
forOf(iterable, function (value) { | ||
if (eIndexOf.call(this, value) !== -1) return; | ||
this.push(value); | ||
}, this.__setData__); | ||
}, self.__setData__); | ||
return self; | ||
}; | ||
@@ -36,5 +37,3 @@ | ||
if (setPrototypeOf) setPrototypeOf(SetPoly, Set); | ||
SetPoly.prototype = Object.create(Set.prototype, { | ||
constructor: d(SetPoly) | ||
}); | ||
SetPoly.prototype = Object.create(Set.prototype, { constructor: d(SetPoly) }); | ||
} | ||
@@ -41,0 +40,0 @@ |
@@ -11,5 +11,6 @@ 'use strict'; | ||
, Iterator = require('../lib/primitive-iterator') | ||
, isNative = require('../is-native-implemented') | ||
, create = Object.create, defineProperties = Object.defineProperties | ||
, defineProperty = Object.defineProperty | ||
, defineProperty = Object.defineProperty, getPrototypeOf = Object.getPrototypeOf | ||
, hasOwnProperty = Object.prototype.hasOwnProperty | ||
@@ -19,26 +20,24 @@ , PrimitiveSet; | ||
module.exports = PrimitiveSet = function (/*iterable, serialize*/) { | ||
var iterable = arguments[0], serialize = arguments[1]; | ||
if (!(this instanceof PrimitiveSet)) { | ||
return new PrimitiveSet(iterable, serialize); | ||
} | ||
if (this.__setData__ !== undefined) { | ||
throw new TypeError(this + " cannot be reinitialized"); | ||
} | ||
var iterable = arguments[0], serialize = arguments[1], self; | ||
if (!(this instanceof PrimitiveSet)) throw new TypeError('Constructor requires \'new\''); | ||
if (isNative && setPrototypeOf) self = setPrototypeOf(new Set(), getPrototypeOf(this)); | ||
else self = this; | ||
if (iterable != null) iterator(iterable); | ||
if (serialize !== undefined) { | ||
callable(serialize); | ||
defineProperty(this, '_serialize', d('', serialize)); | ||
defineProperty(self, '_serialize', d('', serialize)); | ||
} | ||
defineProperties(this, { | ||
defineProperties(self, { | ||
__setData__: d('c', create(null)), | ||
__size__: d('w', 0) | ||
}); | ||
if (!iterable) return; | ||
if (!iterable) return self; | ||
forOf(iterable, function (value) { | ||
var key = this._serialize(value); | ||
var key = self._serialize(value); | ||
if (key == null) throw new TypeError(value + " cannot be serialized"); | ||
if (hasOwnProperty.call(this.__setData__, key)) return; | ||
this.__setData__[key] = value; | ||
++this.__size__; | ||
}, this); | ||
if (hasOwnProperty.call(self.__setData__, key)) return; | ||
self.__setData__[key] = value; | ||
++self.__size__; | ||
}); | ||
return self; | ||
}; | ||
@@ -45,0 +44,0 @@ if (setPrototypeOf) setPrototypeOf(PrimitiveSet, Set); |
@@ -44,2 +44,8 @@ 'use strict'; | ||
a.deep(toArray(set), [], "Clear: Values"); | ||
a.h1("Empty initialization"); | ||
set = new T(); | ||
set.add('foo'); | ||
a(set.size, 1); | ||
a(set.has('foo'), true); | ||
}; |
@@ -44,2 +44,8 @@ 'use strict'; | ||
a.deep(toArray(set.values()), [], "Clear: Values"); | ||
a.h1("Empty initialization"); | ||
set = new T(); | ||
set.add('foo'); | ||
a(set.size, 1); | ||
a(set.has('foo'), true); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27197
39
639
- Removedes6-iterator@0.1.3(transitive)
- Removedes6-symbol@0.1.12.0.1(transitive)
Updatedes5-ext@~0.10.8
Updatedes6-iterator@2
Updatedes6-symbol@3
Updatedevent-emitter@~0.3.4