Skip to content

Commit c99cb71

Browse files
committed
bumping to 0.0.2
1 parent 496abe9 commit c99cb71

File tree

3 files changed

+106
-79
lines changed

3 files changed

+106
-79
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "immutable-proxy",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "access immutable values more easily",
55
"main": "lib/index.js",
66
"peerDependencies": {
@@ -25,12 +25,12 @@
2525
},
2626
"repository": {
2727
"type": "git",
28-
"url": "git+ssh://[email protected]/zackify/fragment.git"
28+
"url": "git+ssh://[email protected]/zackify/immutable-proxy.git"
2929
},
3030
"author": "Zach Silveira",
3131
"license": "ISC",
3232
"bugs": {
33-
"url": "https://github.com/zackify/fragment/issues"
33+
"url": "https://github.com/zackify/immutable-proxy/issues"
3434
},
35-
"homepage": "https://github.com/zackify/fragment#readme"
35+
"homepage": "https://github.com/zackify/immutable-proxy#readme"
3636
}

umd/index.js

Lines changed: 100 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,18 @@ return /******/ (function(modules) { // webpackBootstrap
6262

6363
var _immutable2 = _interopRequireDefault(_immutable);
6464

65-
var _map = __webpack_require__(2);
65+
var _list = __webpack_require__(2);
66+
67+
var _list2 = _interopRequireDefault(_list);
68+
69+
var _map = __webpack_require__(3);
6670

6771
var _map2 = _interopRequireDefault(_map);
6872

6973
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7074

7175
module.exports = _extends({}, _immutable2.default, {
76+
List: _list2.default,
7277
Map: _map2.default
7378
});
7479

@@ -88,7 +93,7 @@ return /******/ (function(modules) { // webpackBootstrap
8893
(function (global, factory) {
8994
true ? module.exports = factory() :
9095
typeof define === 'function' && define.amd ? define(factory) :
91-
global.Immutable = factory();
96+
(global.Immutable = factory());
9297
}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;
9398

9499
function createClass(ctor, superClass) {
@@ -983,7 +988,7 @@ return /******/ (function(modules) { // webpackBootstrap
983988
}
984989
return 'Range [ ' +
985990
this._start + '...' + this._end +
986-
(this._step > 1 ? ' by ' + this._step : '') +
991+
(this._step !== 1 ? ' by ' + this._step : '') +
987992
' ]';
988993
};
989994

@@ -1115,6 +1120,9 @@ return /******/ (function(modules) { // webpackBootstrap
11151120
}
11161121
var type = typeof o;
11171122
if (type === 'number') {
1123+
if (o !== o || o === Infinity) {
1124+
return 0;
1125+
}
11181126
var h = o | 0;
11191127
if (h !== o) {
11201128
h ^= o * 0xFFFFFFFF;
@@ -1300,6 +1308,17 @@ return /******/ (function(modules) { // webpackBootstrap
13001308
});
13011309
}
13021310

1311+
Map.of = function() {var keyValues = SLICE$0.call(arguments, 0);
1312+
return emptyMap().withMutations(function(map ) {
1313+
for (var i = 0; i < keyValues.length; i += 2) {
1314+
if (i + 1 >= keyValues.length) {
1315+
throw new Error('Missing value for key: ' + keyValues[i]);
1316+
}
1317+
map.set(keyValues[i], keyValues[i + 1]);
1318+
}
1319+
});
1320+
};
1321+
13031322
Map.prototype.toString = function() {
13041323
return this.__toString('Map {', '}');
13051324
};
@@ -3212,7 +3231,11 @@ return /******/ (function(modules) { // webpackBootstrap
32123231
begin = begin | 0;
32133232
}
32143233
if (end !== undefined) {
3215-
end = end | 0;
3234+
if (end === Infinity) {
3235+
end = originalSize;
3236+
} else {
3237+
end = end | 0;
3238+
}
32163239
}
32173240

32183241
if (wholeSlice(begin, end, originalSize)) {
@@ -3749,6 +3772,12 @@ return /******/ (function(modules) { // webpackBootstrap
37493772
if (!this.has(k)) {
37503773
throw new Error('Cannot set unknown key "' + k + '" on ' + recordName(this));
37513774
}
3775+
if (this._map && !this._map.has(k)) {
3776+
var defaultVal = this._defaultValues[k];
3777+
if (v === defaultVal) {
3778+
return this;
3779+
}
3780+
}
37523781
var newMap = this._map && this._map.set(k, v);
37533782
if (this.__ownerID || newMap === this._map) {
37543783
return this;
@@ -4432,21 +4461,6 @@ return /******/ (function(modules) { // webpackBootstrap
44324461
return entry ? entry[1] : notSetValue;
44334462
},
44344463

4435-
findEntry: function(predicate, context) {
4436-
var found;
4437-
this.__iterate(function(v, k, c) {
4438-
if (predicate.call(context, v, k, c)) {
4439-
found = [k, v];
4440-
return false;
4441-
}
4442-
});
4443-
return found;
4444-
},
4445-
4446-
findLastEntry: function(predicate, context) {
4447-
return this.toSeq().reverse().findEntry(predicate, context);
4448-
},
4449-
44504464
forEach: function(sideEffect, context) {
44514465
assertNotInfinite(this.size);
44524466
return this.__iterate(context ? sideEffect.bind(context) : sideEffect);
@@ -4557,10 +4571,34 @@ return /******/ (function(modules) { // webpackBootstrap
45574571
return this.filter(not(predicate), context);
45584572
},
45594573

4574+
findEntry: function(predicate, context, notSetValue) {
4575+
var found = notSetValue;
4576+
this.__iterate(function(v, k, c) {
4577+
if (predicate.call(context, v, k, c)) {
4578+
found = [k, v];
4579+
return false;
4580+
}
4581+
});
4582+
return found;
4583+
},
4584+
4585+
findKey: function(predicate, context) {
4586+
var entry = this.findEntry(predicate, context);
4587+
return entry && entry[0];
4588+
},
4589+
45604590
findLast: function(predicate, context, notSetValue) {
45614591
return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
45624592
},
45634593

4594+
findLastEntry: function(predicate, context, notSetValue) {
4595+
return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);
4596+
},
4597+
4598+
findLastKey: function(predicate, context) {
4599+
return this.toKeyedSeq().reverse().findKey(predicate, context);
4600+
},
4601+
45644602
first: function() {
45654603
return this.find(returnTrue);
45664604
},
@@ -4619,6 +4657,10 @@ return /******/ (function(modules) { // webpackBootstrap
46194657
return iter.isSubset(this);
46204658
},
46214659

4660+
keyOf: function(searchValue) {
4661+
return this.findKey(function(value ) {return is(value, searchValue)});
4662+
},
4663+
46224664
keySeq: function() {
46234665
return this.toSeq().map(keyMapper).toIndexedSeq();
46244666
},
@@ -4627,6 +4669,10 @@ return /******/ (function(modules) { // webpackBootstrap
46274669
return this.toSeq().reverse().first();
46284670
},
46294671

4672+
lastKeyOf: function(searchValue) {
4673+
return this.toKeyedSeq().reverse().keyOf(searchValue);
4674+
},
4675+
46304676
max: function(comparator) {
46314677
return maxFactory(this, comparator);
46324678
},
@@ -4717,35 +4763,6 @@ return /******/ (function(modules) { // webpackBootstrap
47174763
IterablePrototype.chain = IterablePrototype.flatMap;
47184764
IterablePrototype.contains = IterablePrototype.includes;
47194765

4720-
// Temporary warning about using length
4721-
(function () {
4722-
try {
4723-
Object.defineProperty(IterablePrototype, 'length', {
4724-
get: function () {
4725-
if (!Iterable.noLengthWarning) {
4726-
var stack;
4727-
try {
4728-
throw new Error();
4729-
} catch (error) {
4730-
stack = error.stack;
4731-
}
4732-
if (stack.indexOf('_wrapObject') === -1) {
4733-
console && console.warn && console.warn(
4734-
'iterable.length has been deprecated, '+
4735-
'use iterable.size or iterable.count(). '+
4736-
'This warning will become a silent error in a future version. ' +
4737-
stack
4738-
);
4739-
return this.size;
4740-
}
4741-
}
4742-
}
4743-
});
4744-
} catch (e) {}
4745-
})();
4746-
4747-
4748-
47494766
mixin(KeyedIterable, {
47504767

47514768
// ### More sequential methods
@@ -4754,23 +4771,6 @@ return /******/ (function(modules) { // webpackBootstrap
47544771
return reify(this, flipFactory(this));
47554772
},
47564773

4757-
findKey: function(predicate, context) {
4758-
var entry = this.findEntry(predicate, context);
4759-
return entry && entry[0];
4760-
},
4761-
4762-
findLastKey: function(predicate, context) {
4763-
return this.toSeq().reverse().findKey(predicate, context);
4764-
},
4765-
4766-
keyOf: function(searchValue) {
4767-
return this.findKey(function(value ) {return is(value, searchValue)});
4768-
},
4769-
4770-
lastKeyOf: function(searchValue) {
4771-
return this.findLastKey(function(value ) {return is(value, searchValue)});
4772-
},
4773-
47744774
mapEntries: function(mapper, context) {var this$0 = this;
47754775
var iterations = 0;
47764776
return reify(this,
@@ -4819,16 +4819,13 @@ return /******/ (function(modules) { // webpackBootstrap
48194819
},
48204820

48214821
indexOf: function(searchValue) {
4822-
var key = this.toKeyedSeq().keyOf(searchValue);
4822+
var key = this.keyOf(searchValue);
48234823
return key === undefined ? -1 : key;
48244824
},
48254825

48264826
lastIndexOf: function(searchValue) {
4827-
var key = this.toKeyedSeq().reverse().keyOf(searchValue);
4827+
var key = this.lastKeyOf(searchValue);
48284828
return key === undefined ? -1 : key;
4829-
4830-
// var index =
4831-
// return this.toSeq().reverse().indexOf(searchValue);
48324829
},
48334830

48344831
reverse: function() {
@@ -4862,8 +4859,8 @@ return /******/ (function(modules) { // webpackBootstrap
48624859
// ### More collection methods
48634860

48644861
findLastIndex: function(predicate, context) {
4865-
var key = this.toKeyedSeq().findLastKey(predicate, context);
4866-
return key === undefined ? -1 : key;
4862+
var entry = this.findLastEntry(predicate, context);
4863+
return entry ? entry[0] : -1;
48674864
},
48684865

48694866
first: function() {
@@ -4904,6 +4901,10 @@ return /******/ (function(modules) { // webpackBootstrap
49044901
return reify(this, interleaved);
49054902
},
49064903

4904+
keySeq: function() {
4905+
return Range(0, this.size);
4906+
},
4907+
49074908
last: function() {
49084909
return this.get(-1);
49094910
},
@@ -4952,6 +4953,7 @@ return /******/ (function(modules) { // webpackBootstrap
49524953
});
49534954

49544955
SetIterable.prototype.has = IterablePrototype.includes;
4956+
SetIterable.prototype.contains = SetIterable.prototype.includes;
49554957

49564958

49574959
// Mixin subclasses
@@ -4988,7 +4990,7 @@ return /******/ (function(modules) { // webpackBootstrap
49884990
}
49894991

49904992
function quoteString(value) {
4991-
return typeof value === 'string' ? JSON.stringify(value) : value;
4993+
return typeof value === 'string' ? JSON.stringify(value) : String(value);
49924994
}
49934995

49944996
function defaultZipper() {
@@ -5071,8 +5073,33 @@ return /******/ (function(modules) { // webpackBootstrap
50715073

50725074
var _immutable = __webpack_require__(1);
50735075

5076+
exports.default = function (initialData) {
5077+
var immutableList = (0, _immutable.List)(initialData);
5078+
5079+
return new Proxy(immutableList, {
5080+
get: function get(proxy, name) {
5081+
var immutableName = name === 'length' ? 'size' : name;
5082+
5083+
return immutableList.get(immutableName) || immutableList[immutableName];
5084+
}
5085+
});
5086+
};
5087+
5088+
/***/ },
5089+
/* 3 */
5090+
/***/ function(module, exports, __webpack_require__) {
5091+
5092+
'use strict';
5093+
5094+
Object.defineProperty(exports, "__esModule", {
5095+
value: true
5096+
});
5097+
5098+
var _immutable = __webpack_require__(1);
5099+
50745100
exports.default = function (initialData) {
50755101
var immutableMap = (0, _immutable.Map)(initialData);
5102+
50765103
return new Proxy(immutableMap, {
50775104
get: function get(proxy, name) {
50785105
return immutableMap.get(name) || immutableMap[name];

0 commit comments

Comments
 (0)