es6_set_polyfill_rails 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/es6_set_polyfill_rails.js +1228 -261
- data/lib/es6_set_polyfill_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8afe0f23c538852ad52c80aecde135309147f3a5
|
4
|
+
data.tar.gz: 0ce17e0504f3d087e17a7916f42da4876abdc577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 578210730317b711643ebbf60f9889bced0bd1f655fd991b250b0b2133b5f58a0a42791d0d9aaf744ab5298b7d7e3ce3e3ba5a58382279a2b7a20d996d46fea9
|
7
|
+
data.tar.gz: 15e7f3c9f8dcca3c393f54d5fd5fdbd27de46cc929b200d9b440e29e408f74f19c83b61d257b7e5ac475f0e6721eef86b3982f8715a960a2f3ee783d4f69564c
|
@@ -1,287 +1,1254 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
/**
|
4
|
-
* es6-map-shim.js is a DESTRUCTIVE shim that follows the latest Map specification as closely as possible.
|
5
|
-
* It is destructive in the sense that it overrides native implementations.
|
6
|
-
*
|
7
|
-
* This library assumes ES5 functionality: Object.create, Object.defineProperty, Array.indexOf, Function.bind
|
8
|
-
*/
|
9
|
-
(function(module) {
|
10
|
-
function Map(iterable) {
|
11
|
-
var _items = [];
|
12
|
-
var _keys = [];
|
13
|
-
var _values = [];
|
14
|
-
|
15
|
-
// Object.is polyfill, courtesy of @WebReflection
|
16
|
-
var is = Object.is || function(a, b) {
|
17
|
-
return a === b ?
|
18
|
-
a !== 0 || 1 / a == 1 / b :
|
19
|
-
a != a && b != b;
|
20
|
-
};
|
1
|
+
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
+
'use strict';
|
21
3
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
} else {
|
27
|
-
i = [].indexOf.call(this, value);
|
28
|
-
}
|
29
|
-
return i;
|
30
|
-
};
|
4
|
+
var copy = require('es5-ext/object/copy')
|
5
|
+
, map = require('es5-ext/object/map')
|
6
|
+
, callable = require('es5-ext/object/valid-callable')
|
7
|
+
, validValue = require('es5-ext/object/valid-value')
|
31
8
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
return Object.create({}, {
|
36
|
-
next: {
|
37
|
-
value: function() {
|
38
|
-
// check if index is within bounds
|
39
|
-
if (_index < map.items().length) {
|
40
|
-
switch(kind) {
|
41
|
-
case 'keys': return map.keys()[_index++];
|
42
|
-
case 'values': return map.values()[_index++];
|
43
|
-
case 'keys+values': return [].slice.call(map.items()[_index++]);
|
44
|
-
default: throw new TypeError('Invalid iterator type');
|
45
|
-
}
|
46
|
-
}
|
47
|
-
// TODO: make sure I'm interpreting the spec correctly here
|
48
|
-
throw new Error('Stop Iteration');
|
49
|
-
}
|
50
|
-
},
|
51
|
-
iterator: {
|
52
|
-
value: function() {
|
53
|
-
return this;
|
54
|
-
}
|
55
|
-
},
|
56
|
-
toString: {
|
57
|
-
value: function() {
|
58
|
-
return '[object Map Iterator]';
|
59
|
-
}
|
60
|
-
}
|
61
|
-
});
|
62
|
-
};
|
9
|
+
, bind = Function.prototype.bind, defineProperty = Object.defineProperty
|
10
|
+
, hasOwnProperty = Object.prototype.hasOwnProperty
|
11
|
+
, define;
|
63
12
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
13
|
+
define = function (name, desc, bindTo) {
|
14
|
+
var value = validValue(desc) && callable(desc.value), dgs;
|
15
|
+
dgs = copy(desc);
|
16
|
+
delete dgs.writable;
|
17
|
+
delete dgs.value;
|
18
|
+
dgs.get = function () {
|
19
|
+
if (hasOwnProperty.call(this, name)) return value;
|
20
|
+
desc.value = bind.call(value, (bindTo == null) ? this : this[bindTo]);
|
21
|
+
defineProperty(this, name, desc);
|
22
|
+
return this[name];
|
23
|
+
};
|
24
|
+
return dgs;
|
25
|
+
};
|
76
26
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
27
|
+
module.exports = function (props/*, bindTo*/) {
|
28
|
+
var bindTo = arguments[1];
|
29
|
+
return map(props, function (desc, name) {
|
30
|
+
return define(name, desc, bindTo);
|
31
|
+
});
|
32
|
+
};
|
81
33
|
|
82
|
-
|
83
|
-
|
34
|
+
},{"es5-ext/object/copy":15,"es5-ext/object/map":23,"es5-ext/object/valid-callable":28,"es5-ext/object/valid-value":29}],2:[function(require,module,exports){
|
35
|
+
'use strict';
|
84
36
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
} else if (iterable !== undefined) {
|
90
|
-
throw new TypeError('Invalid Map');
|
91
|
-
}
|
37
|
+
var assign = require('es5-ext/object/assign')
|
38
|
+
, normalizeOpts = require('es5-ext/object/normalize-options')
|
39
|
+
, isCallable = require('es5-ext/object/is-callable')
|
40
|
+
, contains = require('es5-ext/string/#/contains')
|
92
41
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
return '[Object Map]';
|
179
|
-
}
|
180
|
-
}
|
181
|
-
});
|
42
|
+
, d;
|
43
|
+
|
44
|
+
d = module.exports = function (dscr, value/*, options*/) {
|
45
|
+
var c, e, w, options, desc;
|
46
|
+
if ((arguments.length < 2) || (typeof dscr !== 'string')) {
|
47
|
+
options = value;
|
48
|
+
value = dscr;
|
49
|
+
dscr = null;
|
50
|
+
} else {
|
51
|
+
options = arguments[2];
|
52
|
+
}
|
53
|
+
if (dscr == null) {
|
54
|
+
c = w = true;
|
55
|
+
e = false;
|
56
|
+
} else {
|
57
|
+
c = contains.call(dscr, 'c');
|
58
|
+
e = contains.call(dscr, 'e');
|
59
|
+
w = contains.call(dscr, 'w');
|
60
|
+
}
|
61
|
+
|
62
|
+
desc = { value: value, configurable: c, enumerable: e, writable: w };
|
63
|
+
return !options ? desc : assign(normalizeOpts(options), desc);
|
64
|
+
};
|
65
|
+
|
66
|
+
d.gs = function (dscr, get, set/*, options*/) {
|
67
|
+
var c, e, options, desc;
|
68
|
+
if (typeof dscr !== 'string') {
|
69
|
+
options = set;
|
70
|
+
set = get;
|
71
|
+
get = dscr;
|
72
|
+
dscr = null;
|
73
|
+
} else {
|
74
|
+
options = arguments[3];
|
75
|
+
}
|
76
|
+
if (get == null) {
|
77
|
+
get = undefined;
|
78
|
+
} else if (!isCallable(get)) {
|
79
|
+
options = get;
|
80
|
+
get = set = undefined;
|
81
|
+
} else if (set == null) {
|
82
|
+
set = undefined;
|
83
|
+
} else if (!isCallable(set)) {
|
84
|
+
options = set;
|
85
|
+
set = undefined;
|
86
|
+
}
|
87
|
+
if (dscr == null) {
|
88
|
+
c = true;
|
89
|
+
e = false;
|
90
|
+
} else {
|
91
|
+
c = contains.call(dscr, 'c');
|
92
|
+
e = contains.call(dscr, 'e');
|
93
|
+
}
|
94
|
+
|
95
|
+
desc = { get: get, set: set, configurable: c, enumerable: e };
|
96
|
+
return !options ? desc : assign(normalizeOpts(options), desc);
|
97
|
+
};
|
98
|
+
|
99
|
+
},{"es5-ext/object/assign":12,"es5-ext/object/is-callable":18,"es5-ext/object/normalize-options":24,"es5-ext/string/#/contains":30}],3:[function(require,module,exports){
|
100
|
+
// Inspired by Google Closure:
|
101
|
+
// http://closure-library.googlecode.com/svn/docs/
|
102
|
+
// closure_goog_array_array.js.html#goog.array.clear
|
103
|
+
|
104
|
+
'use strict';
|
105
|
+
|
106
|
+
var value = require('../../object/valid-value');
|
107
|
+
|
108
|
+
module.exports = function () {
|
109
|
+
value(this).length = 0;
|
110
|
+
return this;
|
111
|
+
};
|
112
|
+
|
113
|
+
},{"../../object/valid-value":29}],4:[function(require,module,exports){
|
114
|
+
'use strict';
|
115
|
+
|
116
|
+
var toPosInt = require('../../number/to-pos-integer')
|
117
|
+
, value = require('../../object/valid-value')
|
118
|
+
|
119
|
+
, indexOf = Array.prototype.indexOf
|
120
|
+
, hasOwnProperty = Object.prototype.hasOwnProperty
|
121
|
+
, abs = Math.abs, floor = Math.floor;
|
122
|
+
|
123
|
+
module.exports = function (searchElement/*, fromIndex*/) {
|
124
|
+
var i, l, fromIndex, val;
|
125
|
+
if (searchElement === searchElement) { //jslint: ignore
|
126
|
+
return indexOf.apply(this, arguments);
|
182
127
|
}
|
183
128
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
(function() {
|
195
|
-
'use strict';
|
196
|
-
|
197
|
-
/**
|
198
|
-
* Given a filtering function, return a new Map of items matching that
|
199
|
-
* function.
|
200
|
-
*
|
201
|
-
* @param filterFn {Function} that takes up to 3 arguments and returns a Boolean.
|
202
|
-
* @return {Map} a new Map that is the subset of this map's items
|
203
|
-
* that match the given filter function.
|
204
|
-
*/
|
205
|
-
Map.prototype.filter = function(filterFn) {
|
206
|
-
if (typeof filterFn != 'function') {
|
207
|
-
throw new TypeError('Expected a function argument');
|
129
|
+
l = toPosInt(value(this).length);
|
130
|
+
fromIndex = arguments[1];
|
131
|
+
if (isNaN(fromIndex)) fromIndex = 0;
|
132
|
+
else if (fromIndex >= 0) fromIndex = floor(fromIndex);
|
133
|
+
else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
|
134
|
+
|
135
|
+
for (i = fromIndex; i < l; ++i) {
|
136
|
+
if (hasOwnProperty.call(this, i)) {
|
137
|
+
val = this[i];
|
138
|
+
if (val !== val) return i; //jslint: ignore
|
208
139
|
}
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
140
|
+
}
|
141
|
+
return -1;
|
142
|
+
};
|
143
|
+
|
144
|
+
},{"../../number/to-pos-integer":10,"../../object/valid-value":29}],5:[function(require,module,exports){
|
145
|
+
'use strict';
|
146
|
+
|
147
|
+
var toString = Object.prototype.toString
|
148
|
+
|
149
|
+
, id = toString.call((function () { return arguments; }()));
|
150
|
+
|
151
|
+
module.exports = function (x) { return (toString.call(x) === id); };
|
152
|
+
|
153
|
+
},{}],6:[function(require,module,exports){
|
154
|
+
'use strict';
|
155
|
+
|
156
|
+
module.exports = require('./is-implemented')()
|
157
|
+
? Math.sign
|
158
|
+
: require('./shim');
|
159
|
+
|
160
|
+
},{"./is-implemented":7,"./shim":8}],7:[function(require,module,exports){
|
161
|
+
'use strict';
|
162
|
+
|
163
|
+
module.exports = function () {
|
164
|
+
var sign = Math.sign;
|
165
|
+
if (typeof sign !== 'function') return false;
|
166
|
+
return ((sign(10) === 1) && (sign(-20) === -1));
|
167
|
+
};
|
168
|
+
|
169
|
+
},{}],8:[function(require,module,exports){
|
170
|
+
'use strict';
|
171
|
+
|
172
|
+
module.exports = function (value) {
|
173
|
+
value = Number(value);
|
174
|
+
if (isNaN(value) || (value === 0)) return value;
|
175
|
+
return (value > 0) ? 1 : -1;
|
176
|
+
};
|
177
|
+
|
178
|
+
},{}],9:[function(require,module,exports){
|
179
|
+
'use strict';
|
180
|
+
|
181
|
+
var sign = require('../math/sign')
|
182
|
+
|
183
|
+
, abs = Math.abs, floor = Math.floor;
|
184
|
+
|
185
|
+
module.exports = function (value) {
|
186
|
+
if (isNaN(value)) return 0;
|
187
|
+
value = Number(value);
|
188
|
+
if ((value === 0) || !isFinite(value)) return value;
|
189
|
+
return sign(value) * floor(abs(value));
|
190
|
+
};
|
191
|
+
|
192
|
+
},{"../math/sign":6}],10:[function(require,module,exports){
|
193
|
+
'use strict';
|
194
|
+
|
195
|
+
var toInteger = require('./to-integer')
|
196
|
+
|
197
|
+
, max = Math.max;
|
198
|
+
|
199
|
+
module.exports = function (value) { return max(0, toInteger(value)); };
|
200
|
+
|
201
|
+
},{"./to-integer":9}],11:[function(require,module,exports){
|
202
|
+
// Internal method, used by iteration functions.
|
203
|
+
// Calls a function for each key-value pair found in object
|
204
|
+
// Optionally takes compareFn to iterate object in specific order
|
205
|
+
|
206
|
+
'use strict';
|
207
|
+
|
208
|
+
var callable = require('./valid-callable')
|
209
|
+
, value = require('./valid-value')
|
210
|
+
|
211
|
+
, bind = Function.prototype.bind, call = Function.prototype.call, keys = Object.keys
|
212
|
+
, propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
213
|
+
|
214
|
+
module.exports = function (method, defVal) {
|
215
|
+
return function (obj, cb/*, thisArg, compareFn*/) {
|
216
|
+
var list, thisArg = arguments[2], compareFn = arguments[3];
|
217
|
+
obj = Object(value(obj));
|
218
|
+
callable(cb);
|
219
|
+
|
220
|
+
list = keys(obj);
|
221
|
+
if (compareFn) {
|
222
|
+
list.sort((typeof compareFn === 'function') ? bind.call(compareFn, obj) : undefined);
|
223
|
+
}
|
224
|
+
if (typeof method !== 'function') method = list[method];
|
225
|
+
return call.call(method, list, function (key, index) {
|
226
|
+
if (!propertyIsEnumerable.call(obj, key)) return defVal;
|
227
|
+
return call.call(cb, thisArg, obj[key], key, obj, index);
|
214
228
|
});
|
215
|
-
return _map;
|
216
229
|
};
|
230
|
+
};
|
231
|
+
|
232
|
+
},{"./valid-callable":28,"./valid-value":29}],12:[function(require,module,exports){
|
233
|
+
'use strict';
|
234
|
+
|
235
|
+
module.exports = require('./is-implemented')()
|
236
|
+
? Object.assign
|
237
|
+
: require('./shim');
|
238
|
+
|
239
|
+
},{"./is-implemented":13,"./shim":14}],13:[function(require,module,exports){
|
240
|
+
'use strict';
|
241
|
+
|
242
|
+
module.exports = function () {
|
243
|
+
var assign = Object.assign, obj;
|
244
|
+
if (typeof assign !== 'function') return false;
|
245
|
+
obj = { foo: 'raz' };
|
246
|
+
assign(obj, { bar: 'dwa' }, { trzy: 'trzy' });
|
247
|
+
return (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy';
|
248
|
+
};
|
249
|
+
|
250
|
+
},{}],14:[function(require,module,exports){
|
251
|
+
'use strict';
|
252
|
+
|
253
|
+
var keys = require('../keys')
|
254
|
+
, value = require('../valid-value')
|
255
|
+
|
256
|
+
, max = Math.max;
|
217
257
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
*/
|
225
|
-
Map.prototype.merge = function(otherMap) {
|
226
|
-
if (!(otherMap instanceof Map)) {
|
227
|
-
throw new TypeError('Cannot merge with objects that are not Maps');
|
258
|
+
module.exports = function (dest, src/*, …srcn*/) {
|
259
|
+
var error, i, l = max(arguments.length, 2), assign;
|
260
|
+
dest = Object(value(dest));
|
261
|
+
assign = function (key) {
|
262
|
+
try { dest[key] = src[key]; } catch (e) {
|
263
|
+
if (!error) error = e;
|
228
264
|
}
|
265
|
+
};
|
266
|
+
for (i = 1; i < l; ++i) {
|
267
|
+
src = arguments[i];
|
268
|
+
keys(src).forEach(assign);
|
269
|
+
}
|
270
|
+
if (error !== undefined) throw error;
|
271
|
+
return dest;
|
272
|
+
};
|
273
|
+
|
274
|
+
},{"../keys":20,"../valid-value":29}],15:[function(require,module,exports){
|
275
|
+
'use strict';
|
276
|
+
|
277
|
+
var assign = require('./assign')
|
278
|
+
, value = require('./valid-value');
|
279
|
+
|
280
|
+
module.exports = function (obj) {
|
281
|
+
var copy = Object(value(obj));
|
282
|
+
if (copy !== obj) return copy;
|
283
|
+
return assign({}, obj);
|
284
|
+
};
|
285
|
+
|
286
|
+
},{"./assign":12,"./valid-value":29}],16:[function(require,module,exports){
|
287
|
+
// Workaround for http://code.google.com/p/v8/issues/detail?id=2804
|
288
|
+
|
289
|
+
'use strict';
|
290
|
+
|
291
|
+
var create = Object.create, shim;
|
229
292
|
|
230
|
-
|
231
|
-
|
293
|
+
if (!require('./set-prototype-of/is-implemented')()) {
|
294
|
+
shim = require('./set-prototype-of/shim');
|
295
|
+
}
|
296
|
+
|
297
|
+
module.exports = (function () {
|
298
|
+
var nullObject, props, desc;
|
299
|
+
if (!shim) return create;
|
300
|
+
if (shim.level !== 1) return create;
|
301
|
+
|
302
|
+
nullObject = {};
|
303
|
+
props = {};
|
304
|
+
desc = { configurable: false, enumerable: false, writable: true,
|
305
|
+
value: undefined };
|
306
|
+
Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {
|
307
|
+
if (name === '__proto__') {
|
308
|
+
props[name] = { configurable: true, enumerable: false, writable: true,
|
309
|
+
value: undefined };
|
310
|
+
return;
|
232
311
|
}
|
233
|
-
|
312
|
+
props[name] = desc;
|
313
|
+
});
|
314
|
+
Object.defineProperties(nullObject, props);
|
234
315
|
|
235
|
-
|
236
|
-
|
237
|
-
|
316
|
+
Object.defineProperty(shim, 'nullPolyfill', { configurable: false,
|
317
|
+
enumerable: false, writable: false, value: nullObject });
|
318
|
+
|
319
|
+
return function (prototype, props) {
|
320
|
+
return create((prototype === null) ? nullObject : prototype, props);
|
238
321
|
};
|
322
|
+
}());
|
323
|
+
|
324
|
+
},{"./set-prototype-of/is-implemented":26,"./set-prototype-of/shim":27}],17:[function(require,module,exports){
|
325
|
+
'use strict';
|
326
|
+
|
327
|
+
module.exports = require('./_iterate')('forEach');
|
328
|
+
|
329
|
+
},{"./_iterate":11}],18:[function(require,module,exports){
|
330
|
+
// Deprecated
|
331
|
+
|
332
|
+
'use strict';
|
333
|
+
|
334
|
+
module.exports = function (obj) { return typeof obj === 'function'; };
|
335
|
+
|
336
|
+
},{}],19:[function(require,module,exports){
|
337
|
+
'use strict';
|
338
|
+
|
339
|
+
var map = { function: true, object: true };
|
340
|
+
|
341
|
+
module.exports = function (x) {
|
342
|
+
return ((x != null) && map[typeof x]) || false;
|
343
|
+
};
|
344
|
+
|
345
|
+
},{}],20:[function(require,module,exports){
|
346
|
+
'use strict';
|
347
|
+
|
348
|
+
module.exports = require('./is-implemented')()
|
349
|
+
? Object.keys
|
350
|
+
: require('./shim');
|
351
|
+
|
352
|
+
},{"./is-implemented":21,"./shim":22}],21:[function(require,module,exports){
|
353
|
+
'use strict';
|
354
|
+
|
355
|
+
module.exports = function () {
|
356
|
+
try {
|
357
|
+
Object.keys('primitive');
|
358
|
+
return true;
|
359
|
+
} catch (e) { return false; }
|
360
|
+
};
|
361
|
+
|
362
|
+
},{}],22:[function(require,module,exports){
|
363
|
+
'use strict';
|
364
|
+
|
365
|
+
var keys = Object.keys;
|
366
|
+
|
367
|
+
module.exports = function (object) {
|
368
|
+
return keys(object == null ? object : Object(object));
|
369
|
+
};
|
370
|
+
|
371
|
+
},{}],23:[function(require,module,exports){
|
372
|
+
'use strict';
|
373
|
+
|
374
|
+
var callable = require('./valid-callable')
|
375
|
+
, forEach = require('./for-each')
|
376
|
+
|
377
|
+
, call = Function.prototype.call;
|
378
|
+
|
379
|
+
module.exports = function (obj, cb/*, thisArg*/) {
|
380
|
+
var o = {}, thisArg = arguments[2];
|
381
|
+
callable(cb);
|
382
|
+
forEach(obj, function (value, key, obj, index) {
|
383
|
+
o[key] = call.call(cb, thisArg, value, key, obj, index);
|
384
|
+
});
|
385
|
+
return o;
|
386
|
+
};
|
387
|
+
|
388
|
+
},{"./for-each":17,"./valid-callable":28}],24:[function(require,module,exports){
|
389
|
+
'use strict';
|
390
|
+
|
391
|
+
var forEach = Array.prototype.forEach, create = Object.create;
|
239
392
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
if (
|
249
|
-
|
393
|
+
var process = function (src, obj) {
|
394
|
+
var key;
|
395
|
+
for (key in src) obj[key] = src[key];
|
396
|
+
};
|
397
|
+
|
398
|
+
module.exports = function (options/*, …options*/) {
|
399
|
+
var result = create(null);
|
400
|
+
forEach.call(arguments, function (options) {
|
401
|
+
if (options == null) return;
|
402
|
+
process(Object(options), result);
|
403
|
+
});
|
404
|
+
return result;
|
405
|
+
};
|
406
|
+
|
407
|
+
},{}],25:[function(require,module,exports){
|
408
|
+
'use strict';
|
409
|
+
|
410
|
+
module.exports = require('./is-implemented')()
|
411
|
+
? Object.setPrototypeOf
|
412
|
+
: require('./shim');
|
413
|
+
|
414
|
+
},{"./is-implemented":26,"./shim":27}],26:[function(require,module,exports){
|
415
|
+
'use strict';
|
416
|
+
|
417
|
+
var create = Object.create, getPrototypeOf = Object.getPrototypeOf
|
418
|
+
, x = {};
|
419
|
+
|
420
|
+
module.exports = function (/*customCreate*/) {
|
421
|
+
var setPrototypeOf = Object.setPrototypeOf
|
422
|
+
, customCreate = arguments[0] || create;
|
423
|
+
if (typeof setPrototypeOf !== 'function') return false;
|
424
|
+
return getPrototypeOf(setPrototypeOf(customCreate(null), x)) === x;
|
425
|
+
};
|
426
|
+
|
427
|
+
},{}],27:[function(require,module,exports){
|
428
|
+
// Big thanks to @WebReflection for sorting this out
|
429
|
+
// https://gist.github.com/WebReflection/5593554
|
430
|
+
|
431
|
+
'use strict';
|
432
|
+
|
433
|
+
var isObject = require('../is-object')
|
434
|
+
, value = require('../valid-value')
|
435
|
+
|
436
|
+
, isPrototypeOf = Object.prototype.isPrototypeOf
|
437
|
+
, defineProperty = Object.defineProperty
|
438
|
+
, nullDesc = { configurable: true, enumerable: false, writable: true,
|
439
|
+
value: undefined }
|
440
|
+
, validate;
|
441
|
+
|
442
|
+
validate = function (obj, prototype) {
|
443
|
+
value(obj);
|
444
|
+
if ((prototype === null) || isObject(prototype)) return obj;
|
445
|
+
throw new TypeError('Prototype must be null or an object');
|
446
|
+
};
|
447
|
+
|
448
|
+
module.exports = (function (status) {
|
449
|
+
var fn, set;
|
450
|
+
if (!status) return null;
|
451
|
+
if (status.level === 2) {
|
452
|
+
if (status.set) {
|
453
|
+
set = status.set;
|
454
|
+
fn = function (obj, prototype) {
|
455
|
+
set.call(validate(obj, prototype), prototype);
|
456
|
+
return obj;
|
457
|
+
};
|
458
|
+
} else {
|
459
|
+
fn = function (obj, prototype) {
|
460
|
+
validate(obj, prototype).__proto__ = prototype;
|
461
|
+
return obj;
|
462
|
+
};
|
250
463
|
}
|
251
|
-
|
252
|
-
|
464
|
+
} else {
|
465
|
+
fn = function self(obj, prototype) {
|
466
|
+
var isNullBase;
|
467
|
+
validate(obj, prototype);
|
468
|
+
isNullBase = isPrototypeOf.call(self.nullPolyfill, obj);
|
469
|
+
if (isNullBase) delete self.nullPolyfill.__proto__;
|
470
|
+
if (prototype === null) prototype = self.nullPolyfill;
|
471
|
+
obj.__proto__ = prototype;
|
472
|
+
if (isNullBase) defineProperty(self.nullPolyfill, '__proto__', nullDesc);
|
473
|
+
return obj;
|
474
|
+
};
|
475
|
+
}
|
476
|
+
return Object.defineProperty(fn, 'level', { configurable: false,
|
477
|
+
enumerable: false, writable: false, value: status.level });
|
478
|
+
}((function () {
|
479
|
+
var x = Object.create(null), y = {}, set
|
480
|
+
, desc = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__');
|
481
|
+
|
482
|
+
if (desc) {
|
483
|
+
try {
|
484
|
+
set = desc.set; // Opera crashes at this point
|
485
|
+
set.call(x, y);
|
486
|
+
} catch (ignore) { }
|
487
|
+
if (Object.getPrototypeOf(x) === y) return { set: set, level: 2 };
|
488
|
+
}
|
489
|
+
|
490
|
+
x.__proto__ = y;
|
491
|
+
if (Object.getPrototypeOf(x) === y) return { level: 2 };
|
492
|
+
|
493
|
+
x = {};
|
494
|
+
x.__proto__ = y;
|
495
|
+
if (Object.getPrototypeOf(x) === y) return { level: 1 };
|
496
|
+
|
497
|
+
return false;
|
498
|
+
}())));
|
499
|
+
|
500
|
+
require('../create');
|
501
|
+
|
502
|
+
},{"../create":16,"../is-object":19,"../valid-value":29}],28:[function(require,module,exports){
|
503
|
+
'use strict';
|
504
|
+
|
505
|
+
module.exports = function (fn) {
|
506
|
+
if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
|
507
|
+
return fn;
|
508
|
+
};
|
509
|
+
|
510
|
+
},{}],29:[function(require,module,exports){
|
511
|
+
'use strict';
|
512
|
+
|
513
|
+
module.exports = function (value) {
|
514
|
+
if (value == null) throw new TypeError("Cannot use null or undefined");
|
515
|
+
return value;
|
516
|
+
};
|
517
|
+
|
518
|
+
},{}],30:[function(require,module,exports){
|
519
|
+
'use strict';
|
520
|
+
|
521
|
+
module.exports = require('./is-implemented')()
|
522
|
+
? String.prototype.contains
|
523
|
+
: require('./shim');
|
524
|
+
|
525
|
+
},{"./is-implemented":31,"./shim":32}],31:[function(require,module,exports){
|
526
|
+
'use strict';
|
527
|
+
|
528
|
+
var str = 'razdwatrzy';
|
529
|
+
|
530
|
+
module.exports = function () {
|
531
|
+
if (typeof str.contains !== 'function') return false;
|
532
|
+
return ((str.contains('dwa') === true) && (str.contains('foo') === false));
|
533
|
+
};
|
534
|
+
|
535
|
+
},{}],32:[function(require,module,exports){
|
536
|
+
'use strict';
|
253
537
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
538
|
+
var indexOf = String.prototype.indexOf;
|
539
|
+
|
540
|
+
module.exports = function (searchString/*, position*/) {
|
541
|
+
return indexOf.call(this, searchString, arguments[1]) > -1;
|
542
|
+
};
|
543
|
+
|
544
|
+
},{}],33:[function(require,module,exports){
|
545
|
+
'use strict';
|
546
|
+
|
547
|
+
var toString = Object.prototype.toString
|
548
|
+
|
549
|
+
, id = toString.call('');
|
550
|
+
|
551
|
+
module.exports = function (x) {
|
552
|
+
return (typeof x === 'string') || (x && (typeof x === 'object') &&
|
553
|
+
((x instanceof String) || (toString.call(x) === id))) || false;
|
554
|
+
};
|
555
|
+
|
556
|
+
},{}],34:[function(require,module,exports){
|
557
|
+
'use strict';
|
558
|
+
|
559
|
+
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
|
560
|
+
, contains = require('es5-ext/string/#/contains')
|
561
|
+
, d = require('d')
|
562
|
+
, Iterator = require('./')
|
563
|
+
|
564
|
+
, defineProperty = Object.defineProperty
|
565
|
+
, ArrayIterator;
|
566
|
+
|
567
|
+
ArrayIterator = module.exports = function (arr, kind) {
|
568
|
+
if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind);
|
569
|
+
Iterator.call(this, arr);
|
570
|
+
if (!kind) kind = 'value';
|
571
|
+
else if (contains.call(kind, 'key+value')) kind = 'key+value';
|
572
|
+
else if (contains.call(kind, 'key')) kind = 'key';
|
573
|
+
else kind = 'value';
|
574
|
+
defineProperty(this, '__kind__', d('', kind));
|
575
|
+
};
|
576
|
+
if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
|
577
|
+
|
578
|
+
ArrayIterator.prototype = Object.create(Iterator.prototype, {
|
579
|
+
constructor: d(ArrayIterator),
|
580
|
+
_resolve: d(function (i) {
|
581
|
+
if (this.__kind__ === 'value') return this.__list__[i];
|
582
|
+
if (this.__kind__ === 'key+value') return [i, this.__list__[i]];
|
583
|
+
return i;
|
584
|
+
}),
|
585
|
+
toString: d(function () { return '[object Array Iterator]'; })
|
586
|
+
});
|
587
|
+
|
588
|
+
},{"./":37,"d":2,"es5-ext/object/set-prototype-of":25,"es5-ext/string/#/contains":30}],35:[function(require,module,exports){
|
589
|
+
'use strict';
|
590
|
+
|
591
|
+
var isArguments = require('es5-ext/function/is-arguments')
|
592
|
+
, callable = require('es5-ext/object/valid-callable')
|
593
|
+
, isString = require('es5-ext/string/is-string')
|
594
|
+
, get = require('./get')
|
595
|
+
|
596
|
+
, isArray = Array.isArray, call = Function.prototype.call
|
597
|
+
, some = Array.prototype.some;
|
598
|
+
|
599
|
+
module.exports = function (iterable, cb/*, thisArg*/) {
|
600
|
+
var mode, thisArg = arguments[2], result, doBreak, broken, i, l, char, code;
|
601
|
+
if (isArray(iterable) || isArguments(iterable)) mode = 'array';
|
602
|
+
else if (isString(iterable)) mode = 'string';
|
603
|
+
else iterable = get(iterable);
|
604
|
+
|
605
|
+
callable(cb);
|
606
|
+
doBreak = function () { broken = true; };
|
607
|
+
if (mode === 'array') {
|
608
|
+
some.call(iterable, function (value) {
|
609
|
+
call.call(cb, thisArg, value, doBreak);
|
610
|
+
if (broken) return true;
|
611
|
+
});
|
612
|
+
return;
|
613
|
+
}
|
614
|
+
if (mode === 'string') {
|
615
|
+
l = iterable.length;
|
616
|
+
for (i = 0; i < l; ++i) {
|
617
|
+
char = iterable[i];
|
618
|
+
if ((i + 1) < l) {
|
619
|
+
code = char.charCodeAt(0);
|
620
|
+
if ((code >= 0xD800) && (code <= 0xDBFF)) char += iterable[++i];
|
621
|
+
}
|
622
|
+
call.call(cb, thisArg, char, doBreak);
|
623
|
+
if (broken) break;
|
624
|
+
}
|
625
|
+
return;
|
626
|
+
}
|
627
|
+
result = iterable.next();
|
628
|
+
|
629
|
+
while (!result.done) {
|
630
|
+
call.call(cb, thisArg, result.value, doBreak);
|
631
|
+
if (broken) return;
|
632
|
+
result = iterable.next();
|
633
|
+
}
|
634
|
+
};
|
635
|
+
|
636
|
+
},{"./get":36,"es5-ext/function/is-arguments":5,"es5-ext/object/valid-callable":28,"es5-ext/string/is-string":33}],36:[function(require,module,exports){
|
637
|
+
'use strict';
|
638
|
+
|
639
|
+
var isArguments = require('es5-ext/function/is-arguments')
|
640
|
+
, isString = require('es5-ext/string/is-string')
|
641
|
+
, ArrayIterator = require('./array')
|
642
|
+
, StringIterator = require('./string')
|
643
|
+
, iterable = require('./valid-iterable')
|
644
|
+
, iteratorSymbol = require('es6-symbol').iterator;
|
645
|
+
|
646
|
+
module.exports = function (obj) {
|
647
|
+
if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol]();
|
648
|
+
if (isArguments(obj)) return new ArrayIterator(obj);
|
649
|
+
if (isString(obj)) return new StringIterator(obj);
|
650
|
+
return new ArrayIterator(obj);
|
651
|
+
};
|
652
|
+
|
653
|
+
},{"./array":34,"./string":39,"./valid-iterable":40,"es5-ext/function/is-arguments":5,"es5-ext/string/is-string":33,"es6-symbol":46}],37:[function(require,module,exports){
|
654
|
+
'use strict';
|
655
|
+
|
656
|
+
var clear = require('es5-ext/array/#/clear')
|
657
|
+
, assign = require('es5-ext/object/assign')
|
658
|
+
, callable = require('es5-ext/object/valid-callable')
|
659
|
+
, value = require('es5-ext/object/valid-value')
|
660
|
+
, d = require('d')
|
661
|
+
, autoBind = require('d/auto-bind')
|
662
|
+
, Symbol = require('es6-symbol')
|
663
|
+
|
664
|
+
, defineProperty = Object.defineProperty
|
665
|
+
, defineProperties = Object.defineProperties
|
666
|
+
, Iterator;
|
667
|
+
|
668
|
+
module.exports = Iterator = function (list, context) {
|
669
|
+
if (!(this instanceof Iterator)) return new Iterator(list, context);
|
670
|
+
defineProperties(this, {
|
671
|
+
__list__: d('w', value(list)),
|
672
|
+
__context__: d('w', context),
|
673
|
+
__nextIndex__: d('w', 0)
|
674
|
+
});
|
675
|
+
if (!context) return;
|
676
|
+
callable(context.on);
|
677
|
+
context.on('_add', this._onAdd);
|
678
|
+
context.on('_delete', this._onDelete);
|
679
|
+
context.on('_clear', this._onClear);
|
680
|
+
};
|
681
|
+
|
682
|
+
defineProperties(Iterator.prototype, assign({
|
683
|
+
constructor: d(Iterator),
|
684
|
+
_next: d(function () {
|
685
|
+
var i;
|
686
|
+
if (!this.__list__) return;
|
687
|
+
if (this.__redo__) {
|
688
|
+
i = this.__redo__.shift();
|
689
|
+
if (i !== undefined) return i;
|
690
|
+
}
|
691
|
+
if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
|
692
|
+
this._unBind();
|
693
|
+
}),
|
694
|
+
next: d(function () { return this._createResult(this._next()); }),
|
695
|
+
_createResult: d(function (i) {
|
696
|
+
if (i === undefined) return { done: true, value: undefined };
|
697
|
+
return { done: false, value: this._resolve(i) };
|
698
|
+
}),
|
699
|
+
_resolve: d(function (i) { return this.__list__[i]; }),
|
700
|
+
_unBind: d(function () {
|
701
|
+
this.__list__ = null;
|
702
|
+
delete this.__redo__;
|
703
|
+
if (!this.__context__) return;
|
704
|
+
this.__context__.off('_add', this._onAdd);
|
705
|
+
this.__context__.off('_delete', this._onDelete);
|
706
|
+
this.__context__.off('_clear', this._onClear);
|
707
|
+
this.__context__ = null;
|
708
|
+
}),
|
709
|
+
toString: d(function () { return '[object Iterator]'; })
|
710
|
+
}, autoBind({
|
711
|
+
_onAdd: d(function (index) {
|
712
|
+
if (index >= this.__nextIndex__) return;
|
713
|
+
++this.__nextIndex__;
|
714
|
+
if (!this.__redo__) {
|
715
|
+
defineProperty(this, '__redo__', d('c', [index]));
|
716
|
+
return;
|
717
|
+
}
|
718
|
+
this.__redo__.forEach(function (redo, i) {
|
719
|
+
if (redo >= index) this.__redo__[i] = ++redo;
|
720
|
+
}, this);
|
721
|
+
this.__redo__.push(index);
|
722
|
+
}),
|
723
|
+
_onDelete: d(function (index) {
|
724
|
+
var i;
|
725
|
+
if (index >= this.__nextIndex__) return;
|
726
|
+
--this.__nextIndex__;
|
727
|
+
if (!this.__redo__) return;
|
728
|
+
i = this.__redo__.indexOf(index);
|
729
|
+
if (i !== -1) this.__redo__.splice(i, 1);
|
730
|
+
this.__redo__.forEach(function (redo, i) {
|
731
|
+
if (redo > index) this.__redo__[i] = --redo;
|
732
|
+
}, this);
|
733
|
+
}),
|
734
|
+
_onClear: d(function () {
|
735
|
+
if (this.__redo__) clear.call(this.__redo__);
|
736
|
+
this.__nextIndex__ = 0;
|
737
|
+
})
|
738
|
+
})));
|
739
|
+
|
740
|
+
defineProperty(Iterator.prototype, Symbol.iterator, d(function () {
|
741
|
+
return this;
|
742
|
+
}));
|
743
|
+
defineProperty(Iterator.prototype, Symbol.toStringTag, d('', 'Iterator'));
|
744
|
+
|
745
|
+
},{"d":2,"d/auto-bind":1,"es5-ext/array/#/clear":3,"es5-ext/object/assign":12,"es5-ext/object/valid-callable":28,"es5-ext/object/valid-value":29,"es6-symbol":46}],38:[function(require,module,exports){
|
746
|
+
'use strict';
|
747
|
+
|
748
|
+
var isArguments = require('es5-ext/function/is-arguments')
|
749
|
+
, isString = require('es5-ext/string/is-string')
|
750
|
+
, iteratorSymbol = require('es6-symbol').iterator
|
751
|
+
|
752
|
+
, isArray = Array.isArray;
|
753
|
+
|
754
|
+
module.exports = function (value) {
|
755
|
+
if (value == null) return false;
|
756
|
+
if (isArray(value)) return true;
|
757
|
+
if (isString(value)) return true;
|
758
|
+
if (isArguments(value)) return true;
|
759
|
+
return (typeof value[iteratorSymbol] === 'function');
|
760
|
+
};
|
761
|
+
|
762
|
+
},{"es5-ext/function/is-arguments":5,"es5-ext/string/is-string":33,"es6-symbol":46}],39:[function(require,module,exports){
|
763
|
+
// Thanks @mathiasbynens
|
764
|
+
// http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols
|
765
|
+
|
766
|
+
'use strict';
|
767
|
+
|
768
|
+
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
|
769
|
+
, d = require('d')
|
770
|
+
, Iterator = require('./')
|
771
|
+
|
772
|
+
, defineProperty = Object.defineProperty
|
773
|
+
, StringIterator;
|
774
|
+
|
775
|
+
StringIterator = module.exports = function (str) {
|
776
|
+
if (!(this instanceof StringIterator)) return new StringIterator(str);
|
777
|
+
str = String(str);
|
778
|
+
Iterator.call(this, str);
|
779
|
+
defineProperty(this, '__length__', d('', str.length));
|
780
|
+
|
781
|
+
};
|
782
|
+
if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
|
783
|
+
|
784
|
+
StringIterator.prototype = Object.create(Iterator.prototype, {
|
785
|
+
constructor: d(StringIterator),
|
786
|
+
_next: d(function () {
|
787
|
+
if (!this.__list__) return;
|
788
|
+
if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
|
789
|
+
this._unBind();
|
790
|
+
}),
|
791
|
+
_resolve: d(function (i) {
|
792
|
+
var char = this.__list__[i], code;
|
793
|
+
if (this.__nextIndex__ === this.__length__) return char;
|
794
|
+
code = char.charCodeAt(0);
|
795
|
+
if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++];
|
796
|
+
return char;
|
797
|
+
}),
|
798
|
+
toString: d(function () { return '[object String Iterator]'; })
|
799
|
+
});
|
800
|
+
|
801
|
+
},{"./":37,"d":2,"es5-ext/object/set-prototype-of":25}],40:[function(require,module,exports){
|
802
|
+
'use strict';
|
803
|
+
|
804
|
+
var isIterable = require('./is-iterable');
|
805
|
+
|
806
|
+
module.exports = function (value) {
|
807
|
+
if (!isIterable(value)) throw new TypeError(value + " is not iterable");
|
808
|
+
return value;
|
809
|
+
};
|
810
|
+
|
811
|
+
},{"./is-iterable":38}],41:[function(require,module,exports){
|
812
|
+
'use strict';
|
813
|
+
|
814
|
+
module.exports = require('./is-implemented')() ? Set : require('./polyfill');
|
815
|
+
|
816
|
+
},{"./is-implemented":42,"./polyfill":45}],42:[function(require,module,exports){
|
817
|
+
'use strict';
|
818
|
+
|
819
|
+
module.exports = function () {
|
820
|
+
var set, iterator, result;
|
821
|
+
if (typeof Set !== 'function') return false;
|
822
|
+
set = new Set(['raz', 'dwa', 'trzy']);
|
823
|
+
if (String(set) !== '[object Set]') return false;
|
824
|
+
if (set.size !== 3) return false;
|
825
|
+
if (typeof set.add !== 'function') return false;
|
826
|
+
if (typeof set.clear !== 'function') return false;
|
827
|
+
if (typeof set.delete !== 'function') return false;
|
828
|
+
if (typeof set.entries !== 'function') return false;
|
829
|
+
if (typeof set.forEach !== 'function') return false;
|
830
|
+
if (typeof set.has !== 'function') return false;
|
831
|
+
if (typeof set.keys !== 'function') return false;
|
832
|
+
if (typeof set.values !== 'function') return false;
|
833
|
+
|
834
|
+
iterator = set.values();
|
835
|
+
result = iterator.next();
|
836
|
+
if (result.done !== false) return false;
|
837
|
+
if (result.value !== 'raz') return false;
|
838
|
+
|
839
|
+
return true;
|
840
|
+
};
|
841
|
+
|
842
|
+
},{}],43:[function(require,module,exports){
|
843
|
+
// Exports true if environment provides native `Set` implementation,
|
844
|
+
// whatever that is.
|
845
|
+
|
846
|
+
'use strict';
|
847
|
+
|
848
|
+
module.exports = (function () {
|
849
|
+
if (typeof Set === 'undefined') return false;
|
850
|
+
return (Object.prototype.toString.call(Set.prototype) === '[object Set]');
|
851
|
+
}());
|
852
|
+
|
853
|
+
},{}],44:[function(require,module,exports){
|
854
|
+
'use strict';
|
855
|
+
|
856
|
+
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
|
857
|
+
, contains = require('es5-ext/string/#/contains')
|
858
|
+
, d = require('d')
|
859
|
+
, Iterator = require('es6-iterator')
|
860
|
+
, toStringTagSymbol = require('es6-symbol').toStringTag
|
861
|
+
|
862
|
+
, defineProperty = Object.defineProperty
|
863
|
+
, SetIterator;
|
864
|
+
|
865
|
+
SetIterator = module.exports = function (set, kind) {
|
866
|
+
if (!(this instanceof SetIterator)) return new SetIterator(set, kind);
|
867
|
+
Iterator.call(this, set.__setData__, set);
|
868
|
+
if (!kind) kind = 'value';
|
869
|
+
else if (contains.call(kind, 'key+value')) kind = 'key+value';
|
870
|
+
else kind = 'value';
|
871
|
+
defineProperty(this, '__kind__', d('', kind));
|
872
|
+
};
|
873
|
+
if (setPrototypeOf) setPrototypeOf(SetIterator, Iterator);
|
874
|
+
|
875
|
+
SetIterator.prototype = Object.create(Iterator.prototype, {
|
876
|
+
constructor: d(SetIterator),
|
877
|
+
_resolve: d(function (i) {
|
878
|
+
if (this.__kind__ === 'value') return this.__list__[i];
|
879
|
+
return [this.__list__[i], this.__list__[i]];
|
880
|
+
}),
|
881
|
+
toString: d(function () { return '[object Set Iterator]'; })
|
882
|
+
});
|
883
|
+
defineProperty(SetIterator.prototype, toStringTagSymbol, d('c', 'Set Iterator'));
|
884
|
+
|
885
|
+
},{"d":2,"es5-ext/object/set-prototype-of":25,"es5-ext/string/#/contains":30,"es6-iterator":37,"es6-symbol":46}],45:[function(require,module,exports){
|
886
|
+
'use strict';
|
887
|
+
|
888
|
+
var clear = require('es5-ext/array/#/clear')
|
889
|
+
, eIndexOf = require('es5-ext/array/#/e-index-of')
|
890
|
+
, setPrototypeOf = require('es5-ext/object/set-prototype-of')
|
891
|
+
, callable = require('es5-ext/object/valid-callable')
|
892
|
+
, d = require('d')
|
893
|
+
, ee = require('event-emitter')
|
894
|
+
, Symbol = require('es6-symbol')
|
895
|
+
, iterator = require('es6-iterator/valid-iterable')
|
896
|
+
, forOf = require('es6-iterator/for-of')
|
897
|
+
, Iterator = require('./lib/iterator')
|
898
|
+
, isNative = require('./is-native-implemented')
|
899
|
+
|
900
|
+
, call = Function.prototype.call
|
901
|
+
, defineProperty = Object.defineProperty, getPrototypeOf = Object.getPrototypeOf
|
902
|
+
, SetPoly, getValues, NativeSet;
|
903
|
+
|
904
|
+
if (isNative) NativeSet = Set;
|
905
|
+
|
906
|
+
module.exports = SetPoly = function Set(/*iterable*/) {
|
907
|
+
var iterable = arguments[0], self;
|
908
|
+
if (!(this instanceof SetPoly)) throw new TypeError('Constructor requires \'new\'');
|
909
|
+
if (isNative && setPrototypeOf) self = setPrototypeOf(new NativeSet(), getPrototypeOf(this));
|
910
|
+
else self = this;
|
911
|
+
if (iterable != null) iterator(iterable);
|
912
|
+
defineProperty(self, '__setData__', d('c', []));
|
913
|
+
if (!iterable) return self;
|
914
|
+
forOf(iterable, function (value) {
|
915
|
+
if (eIndexOf.call(this, value) !== -1) return;
|
916
|
+
this.push(value);
|
917
|
+
}, self.__setData__);
|
918
|
+
return self;
|
919
|
+
};
|
920
|
+
|
921
|
+
if (isNative) {
|
922
|
+
if (setPrototypeOf) setPrototypeOf(SetPoly, NativeSet);
|
923
|
+
SetPoly.prototype = Object.create(NativeSet.prototype, { constructor: d(SetPoly) });
|
924
|
+
}
|
925
|
+
|
926
|
+
ee(Object.defineProperties(SetPoly.prototype, {
|
927
|
+
add: d(function (value) {
|
928
|
+
if (this.has(value)) return this;
|
929
|
+
this.emit('_add', this.__setData__.push(value) - 1, value);
|
930
|
+
return this;
|
931
|
+
}),
|
932
|
+
clear: d(function () {
|
933
|
+
if (!this.__setData__.length) return;
|
934
|
+
clear.call(this.__setData__);
|
935
|
+
this.emit('_clear');
|
936
|
+
}),
|
937
|
+
delete: d(function (value) {
|
938
|
+
var index = eIndexOf.call(this.__setData__, value);
|
939
|
+
if (index === -1) return false;
|
940
|
+
this.__setData__.splice(index, 1);
|
941
|
+
this.emit('_delete', index, value);
|
942
|
+
return true;
|
943
|
+
}),
|
944
|
+
entries: d(function () { return new Iterator(this, 'key+value'); }),
|
945
|
+
forEach: d(function (cb/*, thisArg*/) {
|
946
|
+
var thisArg = arguments[1], iterator, result, value;
|
947
|
+
callable(cb);
|
948
|
+
iterator = this.values();
|
949
|
+
result = iterator._next();
|
950
|
+
while (result !== undefined) {
|
951
|
+
value = iterator._resolve(result);
|
952
|
+
call.call(cb, thisArg, value, value, this);
|
953
|
+
result = iterator._next();
|
954
|
+
}
|
955
|
+
}),
|
956
|
+
has: d(function (value) {
|
957
|
+
return (eIndexOf.call(this.__setData__, value) !== -1);
|
958
|
+
}),
|
959
|
+
keys: d(getValues = function () { return this.values(); }),
|
960
|
+
size: d.gs(function () { return this.__setData__.length; }),
|
961
|
+
values: d(function () { return new Iterator(this); }),
|
962
|
+
toString: d(function () { return '[object Set]'; })
|
963
|
+
}));
|
964
|
+
defineProperty(SetPoly.prototype, Symbol.iterator, d(getValues));
|
965
|
+
defineProperty(SetPoly.prototype, Symbol.toStringTag, d('c', 'Set'));
|
966
|
+
|
967
|
+
},{"./is-native-implemented":43,"./lib/iterator":44,"d":2,"es5-ext/array/#/clear":3,"es5-ext/array/#/e-index-of":4,"es5-ext/object/set-prototype-of":25,"es5-ext/object/valid-callable":28,"es6-iterator/for-of":35,"es6-iterator/valid-iterable":40,"es6-symbol":46,"event-emitter":51}],46:[function(require,module,exports){
|
968
|
+
'use strict';
|
969
|
+
|
970
|
+
module.exports = require('./is-implemented')() ? Symbol : require('./polyfill');
|
971
|
+
|
972
|
+
},{"./is-implemented":47,"./polyfill":49}],47:[function(require,module,exports){
|
973
|
+
'use strict';
|
974
|
+
|
975
|
+
module.exports = function () {
|
976
|
+
var symbol;
|
977
|
+
if (typeof Symbol !== 'function') return false;
|
978
|
+
symbol = Symbol('test symbol');
|
979
|
+
try { String(symbol); } catch (e) { return false; }
|
980
|
+
if (typeof Symbol.iterator === 'symbol') return true;
|
981
|
+
|
982
|
+
// Return 'true' for polyfills
|
983
|
+
if (typeof Symbol.isConcatSpreadable !== 'object') return false;
|
984
|
+
if (typeof Symbol.iterator !== 'object') return false;
|
985
|
+
if (typeof Symbol.toPrimitive !== 'object') return false;
|
986
|
+
if (typeof Symbol.toStringTag !== 'object') return false;
|
987
|
+
if (typeof Symbol.unscopables !== 'object') return false;
|
988
|
+
|
989
|
+
return true;
|
990
|
+
};
|
991
|
+
|
992
|
+
},{}],48:[function(require,module,exports){
|
993
|
+
'use strict';
|
994
|
+
|
995
|
+
module.exports = function (x) {
|
996
|
+
return (x && ((typeof x === 'symbol') || (x['@@toStringTag'] === 'Symbol'))) || false;
|
997
|
+
};
|
998
|
+
|
999
|
+
},{}],49:[function(require,module,exports){
|
1000
|
+
// ES2015 Symbol polyfill for environments that do not support it (or partially support it_
|
1001
|
+
|
1002
|
+
'use strict';
|
1003
|
+
|
1004
|
+
var d = require('d')
|
1005
|
+
, validateSymbol = require('./validate-symbol')
|
1006
|
+
|
1007
|
+
, create = Object.create, defineProperties = Object.defineProperties
|
1008
|
+
, defineProperty = Object.defineProperty, objPrototype = Object.prototype
|
1009
|
+
, NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null);
|
1010
|
+
|
1011
|
+
if (typeof Symbol === 'function') NativeSymbol = Symbol;
|
1012
|
+
|
1013
|
+
var generateName = (function () {
|
1014
|
+
var created = create(null);
|
1015
|
+
return function (desc) {
|
1016
|
+
var postfix = 0, name, ie11BugWorkaround;
|
1017
|
+
while (created[desc + (postfix || '')]) ++postfix;
|
1018
|
+
desc += (postfix || '');
|
1019
|
+
created[desc] = true;
|
1020
|
+
name = '@@' + desc;
|
1021
|
+
defineProperty(objPrototype, name, d.gs(null, function (value) {
|
1022
|
+
// For IE11 issue see:
|
1023
|
+
// https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
|
1024
|
+
// ie11-broken-getters-on-dom-objects
|
1025
|
+
// https://github.com/medikoo/es6-symbol/issues/12
|
1026
|
+
if (ie11BugWorkaround) return;
|
1027
|
+
ie11BugWorkaround = true;
|
1028
|
+
defineProperty(this, name, d(value));
|
1029
|
+
ie11BugWorkaround = false;
|
1030
|
+
}));
|
1031
|
+
return name;
|
263
1032
|
};
|
1033
|
+
}());
|
1034
|
+
|
1035
|
+
// Internal constructor (not one exposed) for creating Symbol instances.
|
1036
|
+
// This one is used to ensure that `someSymbol instanceof Symbol` always return false
|
1037
|
+
HiddenSymbol = function Symbol(description) {
|
1038
|
+
if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor');
|
1039
|
+
return SymbolPolyfill(description);
|
1040
|
+
};
|
1041
|
+
|
1042
|
+
// Exposed `Symbol` constructor
|
1043
|
+
// (returns instances of HiddenSymbol)
|
1044
|
+
module.exports = SymbolPolyfill = function Symbol(description) {
|
1045
|
+
var symbol;
|
1046
|
+
if (this instanceof Symbol) throw new TypeError('TypeError: Symbol is not a constructor');
|
1047
|
+
symbol = create(HiddenSymbol.prototype);
|
1048
|
+
description = (description === undefined ? '' : String(description));
|
1049
|
+
return defineProperties(symbol, {
|
1050
|
+
__description__: d('', description),
|
1051
|
+
__name__: d('', generateName(description))
|
1052
|
+
});
|
1053
|
+
};
|
1054
|
+
defineProperties(SymbolPolyfill, {
|
1055
|
+
for: d(function (key) {
|
1056
|
+
if (globalSymbols[key]) return globalSymbols[key];
|
1057
|
+
return (globalSymbols[key] = SymbolPolyfill(String(key)));
|
1058
|
+
}),
|
1059
|
+
keyFor: d(function (s) {
|
1060
|
+
var key;
|
1061
|
+
validateSymbol(s);
|
1062
|
+
for (key in globalSymbols) if (globalSymbols[key] === s) return key;
|
1063
|
+
}),
|
1064
|
+
|
1065
|
+
// If there's native implementation of given symbol, let's fallback to it
|
1066
|
+
// to ensure proper interoperability with other native functions e.g. Array.from
|
1067
|
+
hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
|
1068
|
+
isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
|
1069
|
+
SymbolPolyfill('isConcatSpreadable')),
|
1070
|
+
iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
|
1071
|
+
match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
|
1072
|
+
replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
|
1073
|
+
search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
|
1074
|
+
species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
|
1075
|
+
split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
|
1076
|
+
toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
|
1077
|
+
toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
|
1078
|
+
unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
|
1079
|
+
});
|
1080
|
+
|
1081
|
+
// Internal tweaks for real symbol producer
|
1082
|
+
defineProperties(HiddenSymbol.prototype, {
|
1083
|
+
constructor: d(SymbolPolyfill),
|
1084
|
+
toString: d('', function () { return this.__name__; })
|
1085
|
+
});
|
1086
|
+
|
1087
|
+
// Proper implementation of methods exposed on Symbol.prototype
|
1088
|
+
// They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
|
1089
|
+
defineProperties(SymbolPolyfill.prototype, {
|
1090
|
+
toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
|
1091
|
+
valueOf: d(function () { return validateSymbol(this); })
|
1092
|
+
});
|
1093
|
+
defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('',
|
1094
|
+
function () { return validateSymbol(this); }));
|
1095
|
+
defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));
|
1096
|
+
|
1097
|
+
// Proper implementaton of toPrimitive and toStringTag for returned symbol instances
|
1098
|
+
defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
|
1099
|
+
d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
|
1100
|
+
|
1101
|
+
// Note: It's important to define `toPrimitive` as last one, as some implementations
|
1102
|
+
// implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
|
1103
|
+
// And that may invoke error in definition flow:
|
1104
|
+
// See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
|
1105
|
+
defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
|
1106
|
+
d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
|
1107
|
+
|
1108
|
+
},{"./validate-symbol":50,"d":2}],50:[function(require,module,exports){
|
1109
|
+
'use strict';
|
1110
|
+
|
1111
|
+
var isSymbol = require('./is-symbol');
|
1112
|
+
|
1113
|
+
module.exports = function (value) {
|
1114
|
+
if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
|
1115
|
+
return value;
|
1116
|
+
};
|
1117
|
+
|
1118
|
+
},{"./is-symbol":48}],51:[function(require,module,exports){
|
1119
|
+
'use strict';
|
1120
|
+
|
1121
|
+
var d = require('d')
|
1122
|
+
, callable = require('es5-ext/object/valid-callable')
|
264
1123
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
1124
|
+
, apply = Function.prototype.apply, call = Function.prototype.call
|
1125
|
+
, create = Object.create, defineProperty = Object.defineProperty
|
1126
|
+
, defineProperties = Object.defineProperties
|
1127
|
+
, hasOwnProperty = Object.prototype.hasOwnProperty
|
1128
|
+
, descriptor = { configurable: true, enumerable: false, writable: true }
|
1129
|
+
|
1130
|
+
, on, once, off, emit, methods, descriptors, base;
|
1131
|
+
|
1132
|
+
on = function (type, listener) {
|
1133
|
+
var data;
|
1134
|
+
|
1135
|
+
callable(listener);
|
1136
|
+
|
1137
|
+
if (!hasOwnProperty.call(this, '__ee__')) {
|
1138
|
+
data = descriptor.value = create(null);
|
1139
|
+
defineProperty(this, '__ee__', descriptor);
|
1140
|
+
descriptor.value = null;
|
1141
|
+
} else {
|
1142
|
+
data = this.__ee__;
|
1143
|
+
}
|
1144
|
+
if (!data[type]) data[type] = listener;
|
1145
|
+
else if (typeof data[type] === 'object') data[type].push(listener);
|
1146
|
+
else data[type] = [data[type], listener];
|
1147
|
+
|
1148
|
+
return this;
|
1149
|
+
};
|
1150
|
+
|
1151
|
+
once = function (type, listener) {
|
1152
|
+
var once, self;
|
1153
|
+
|
1154
|
+
callable(listener);
|
1155
|
+
self = this;
|
1156
|
+
on.call(this, type, once = function () {
|
1157
|
+
off.call(self, type, once);
|
1158
|
+
apply.call(listener, this, arguments);
|
1159
|
+
});
|
1160
|
+
|
1161
|
+
once.__eeOnceListener__ = listener;
|
1162
|
+
return this;
|
1163
|
+
};
|
1164
|
+
|
1165
|
+
off = function (type, listener) {
|
1166
|
+
var data, listeners, candidate, i;
|
1167
|
+
|
1168
|
+
callable(listener);
|
1169
|
+
|
1170
|
+
if (!hasOwnProperty.call(this, '__ee__')) return this;
|
1171
|
+
data = this.__ee__;
|
1172
|
+
if (!data[type]) return this;
|
1173
|
+
listeners = data[type];
|
1174
|
+
|
1175
|
+
if (typeof listeners === 'object') {
|
1176
|
+
for (i = 0; (candidate = listeners[i]); ++i) {
|
1177
|
+
if ((candidate === listener) ||
|
1178
|
+
(candidate.__eeOnceListener__ === listener)) {
|
1179
|
+
if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
|
1180
|
+
else listeners.splice(i, 1);
|
1181
|
+
}
|
273
1182
|
}
|
274
|
-
|
275
|
-
|
276
|
-
|
1183
|
+
} else {
|
1184
|
+
if ((listeners === listener) ||
|
1185
|
+
(listeners.__eeOnceListener__ === listener)) {
|
1186
|
+
delete data[type];
|
1187
|
+
}
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
return this;
|
1191
|
+
};
|
1192
|
+
|
1193
|
+
emit = function (type) {
|
1194
|
+
var i, l, listener, listeners, args;
|
1195
|
+
|
1196
|
+
if (!hasOwnProperty.call(this, '__ee__')) return;
|
1197
|
+
listeners = this.__ee__[type];
|
1198
|
+
if (!listeners) return;
|
1199
|
+
|
1200
|
+
if (typeof listeners === 'object') {
|
1201
|
+
l = arguments.length;
|
1202
|
+
args = new Array(l - 1);
|
1203
|
+
for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
|
1204
|
+
|
1205
|
+
listeners = listeners.slice();
|
1206
|
+
for (i = 0; (listener = listeners[i]); ++i) {
|
1207
|
+
apply.call(listener, this, args);
|
1208
|
+
}
|
1209
|
+
} else {
|
1210
|
+
switch (arguments.length) {
|
1211
|
+
case 1:
|
1212
|
+
call.call(listeners, this);
|
1213
|
+
break;
|
1214
|
+
case 2:
|
1215
|
+
call.call(listeners, this, arguments[1]);
|
1216
|
+
break;
|
1217
|
+
case 3:
|
1218
|
+
call.call(listeners, this, arguments[1], arguments[2]);
|
1219
|
+
break;
|
1220
|
+
default:
|
1221
|
+
l = arguments.length;
|
1222
|
+
args = new Array(l - 1);
|
1223
|
+
for (i = 1; i < l; ++i) {
|
1224
|
+
args[i - 1] = arguments[i];
|
277
1225
|
}
|
278
|
-
|
279
|
-
|
1226
|
+
apply.call(listeners, this, args);
|
1227
|
+
}
|
1228
|
+
}
|
1229
|
+
};
|
280
1230
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
1231
|
+
methods = {
|
1232
|
+
on: on,
|
1233
|
+
once: once,
|
1234
|
+
off: off,
|
1235
|
+
emit: emit
|
1236
|
+
};
|
1237
|
+
|
1238
|
+
descriptors = {
|
1239
|
+
on: d(on),
|
1240
|
+
once: d(once),
|
1241
|
+
off: d(off),
|
1242
|
+
emit: d(emit)
|
1243
|
+
};
|
1244
|
+
|
1245
|
+
base = defineProperties({}, descriptors);
|
1246
|
+
|
1247
|
+
module.exports = exports = function (o) {
|
1248
|
+
return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
|
1249
|
+
};
|
1250
|
+
exports.methods = methods;
|
1251
|
+
|
1252
|
+
},{"d":2,"es5-ext/object/valid-callable":28}]},{},[41]);
|
1253
|
+
|
1254
|
+
var Set = require('es6-set');
|