Skip to content

Commit c10903b

Browse files
committed
move utils to dir, no prefix on private vars
1 parent bf2e9fa commit c10903b

13 files changed

+86
-83
lines changed

dist/immutable.js

+29-27
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,16 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
172172
};
173173
}
174174
function hasIterator(maybeIterable) {
175-
return !!_iteratorFn(maybeIterable);
175+
return !!getIteratorFn(maybeIterable);
176176
}
177177
function isIterator(maybeIterator) {
178178
return maybeIterator && typeof maybeIterator.next === 'function';
179179
}
180180
function getIterator(iterable) {
181-
var iteratorFn = _iteratorFn(iterable);
181+
var iteratorFn = getIteratorFn(iterable);
182182
return iteratorFn && iteratorFn.call(iterable);
183183
}
184-
function _iteratorFn(iterable) {
184+
function getIteratorFn(iterable) {
185185
var iteratorFn = iterable && ((REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || iterable[FAUX_ITERATOR_SYMBOL]);
186186
if (typeof iteratorFn === 'function') {
187187
return iteratorFn;
@@ -510,37 +510,33 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
510510
return typeof valueA.equals === 'function' && typeof valueB.equals === 'function' ? valueA.equals(valueB) : valueA === valueB || (valueA !== valueA && valueB !== valueB);
511511
}
512512
function fromJS(json, converter) {
513-
return converter ? _fromJSWith(converter, json, '', {'': json}) : _fromJSDefault(json);
513+
return converter ? fromJSWith(converter, json, '', {'': json}) : fromJSDefault(json);
514514
}
515-
function _fromJSWith(converter, json, key, parentJSON) {
515+
function fromJSWith(converter, json, key, parentJSON) {
516516
if (Array.isArray(json)) {
517517
return converter.call(parentJSON, key, IndexedSeq(json).map((function(v, k) {
518-
return _fromJSWith(converter, v, k, json);
518+
return fromJSWith(converter, v, k, json);
519519
})));
520520
}
521521
if (isPlainObj(json)) {
522522
return converter.call(parentJSON, key, KeyedSeq(json).map((function(v, k) {
523-
return _fromJSWith(converter, v, k, json);
523+
return fromJSWith(converter, v, k, json);
524524
})));
525525
}
526526
return json;
527527
}
528-
function _fromJSDefault(json) {
528+
function fromJSDefault(json) {
529529
if (Array.isArray(json)) {
530-
return IndexedSeq(json).map(_fromJSDefault).toList();
530+
return IndexedSeq(json).map(fromJSDefault).toList();
531531
}
532532
if (isPlainObj(json)) {
533-
return KeyedSeq(json).map(_fromJSDefault).toMap();
533+
return KeyedSeq(json).map(fromJSDefault).toMap();
534534
}
535535
return json;
536536
}
537537
function isPlainObj(value) {
538538
return value && value.constructor === Object;
539539
}
540-
function invariant(condition, error) {
541-
if (!condition)
542-
throw new Error(error);
543-
}
544540
var Math__imul = typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? Math.imul : function Math__imul(a, b) {
545541
a = a | 0;
546542
b = b | 0;
@@ -672,6 +668,10 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
672668
var STRING_HASH_CACHE_MAX_SIZE = 255;
673669
var STRING_HASH_CACHE_SIZE = 0;
674670
var stringHashCache = {};
671+
function invariant(condition, error) {
672+
if (!condition)
673+
throw new Error(error);
674+
}
675675
function assertNotInfinite(size) {
676676
invariant(size !== Infinity, 'Cannot perform this action with an infinite size.');
677677
}
@@ -1289,16 +1289,16 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
12891289
var entry = iterable.toSeq().map((function(v, k) {
12901290
return [v, mapper(v, k, iterable)];
12911291
})).reduce((function(a, b) {
1292-
return _maxCompare(comparator, a[1], b[1]) ? b : a;
1292+
return maxCompare(comparator, a[1], b[1]) ? b : a;
12931293
}));
12941294
return entry && entry[0];
12951295
} else {
12961296
return iterable.reduce((function(a, b) {
1297-
return _maxCompare(comparator, a, b) ? b : a;
1297+
return maxCompare(comparator, a, b) ? b : a;
12981298
}));
12991299
}
13001300
}
1301-
function _maxCompare(comparator, a, b) {
1301+
function maxCompare(comparator, a, b) {
13021302
var comp = comparator(b, a);
13031303
return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;
13041304
}
@@ -3184,9 +3184,6 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
31843184
if (end === undefined) {
31853185
end = Infinity;
31863186
}
3187-
if (start === end && __EMPTY_RANGE) {
3188-
return __EMPTY_RANGE;
3189-
}
31903187
step = step === undefined ? 1 : Math.abs(step);
31913188
if (end < start) {
31923189
step = -step;
@@ -3195,6 +3192,12 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
31953192
this._end = end;
31963193
this._step = step;
31973194
this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
3195+
if (this.size === 0) {
3196+
if (EMPTY_RANGE) {
3197+
return EMPTY_RANGE;
3198+
}
3199+
EMPTY_RANGE = this;
3200+
}
31983201
};
31993202
var $Range = Range;
32003203
($traceurRuntime.createClass)(Range, {
@@ -3218,7 +3221,7 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
32183221
begin = resolveBegin(begin, this.size);
32193222
end = resolveEnd(end, this.size);
32203223
if (end <= begin) {
3221-
return __EMPTY_RANGE;
3224+
return new $Range(0, 0);
32223225
}
32233226
return new $Range(this.get(begin, this._end), this.get(end, this._end), this._step);
32243227
},
@@ -3262,17 +3265,17 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
32623265
return other instanceof $Range ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual(this, other);
32633266
}
32643267
}, {}, IndexedSeq);
3265-
var __EMPTY_RANGE = Range(0, 0);
3268+
var EMPTY_RANGE;
32663269
var Repeat = function Repeat(value, times) {
3267-
if (times <= 0 && EMPTY_REPEAT) {
3268-
return EMPTY_REPEAT;
3269-
}
32703270
if (!(this instanceof $Repeat)) {
32713271
return new $Repeat(value, times);
32723272
}
32733273
this._value = value;
32743274
this.size = times === undefined ? Infinity : Math.max(0, times);
32753275
if (this.size === 0) {
3276+
if (EMPTY_REPEAT) {
3277+
return EMPTY_REPEAT;
3278+
}
32763279
EMPTY_REPEAT = this;
32773280
}
32783281
};
@@ -3330,9 +3333,8 @@ $traceurRuntime.defaultSuperCall = defaultSuperCall;
33303333
}, {}, IndexedSeq);
33313334
var EMPTY_REPEAT;
33323335
function mixin(ctor, methods) {
3333-
var proto = ctor.prototype;
33343336
var keyCopier = (function(key) {
3335-
proto[key] = methods[key];
3337+
ctor.prototype[key] = methods[key];
33363338
});
33373339
Object.keys(methods).forEach(keyCopier);
33383340
Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(methods).forEach(keyCopier);

0 commit comments

Comments
 (0)