|
2913 | 2913 | this.size = entries.size;
|
2914 | 2914 | }
|
2915 | 2915 |
|
2916 |
| - FromEntriesSequence.prototype.entrySeq = function() { |
2917 |
| - return this._iter.toSeq(); |
2918 |
| - }; |
2919 |
| - |
2920 | 2916 | FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;
|
2921 | 2917 | return this._iter.__iterate(function(entry ) {
|
2922 | 2918 | // Check if entry exists first so array access doesn't throw for holes
|
|
4271 | 4267 | },
|
4272 | 4268 |
|
4273 | 4269 | toJS: function() {
|
4274 |
| - return this.toSeq().map( |
4275 |
| - function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value} |
4276 |
| - ).__toJS(); |
| 4270 | + return this.toSeq().map(toJS).__toJS(); |
4277 | 4271 | },
|
4278 | 4272 |
|
4279 | 4273 | toJSON: function() {
|
4280 |
| - return this.toSeq().map( |
4281 |
| - function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value} |
4282 |
| - ).__toJS(); |
| 4274 | + return this.toSeq().map(toJSON).__toJS(); |
4283 | 4275 | },
|
4284 | 4276 |
|
4285 | 4277 | toKeyedSeq: function() {
|
|
4486 | 4478 | }
|
4487 | 4479 | var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();
|
4488 | 4480 | entriesSequence.fromEntrySeq = function() {return iterable.toSeq()};
|
| 4481 | + |
| 4482 | + // Entries are plain Array, which do not define toJS/toJSON, so it must |
| 4483 | + // manually converts keys and values before conversion. |
| 4484 | + entriesSequence.toJS = function () { |
| 4485 | + return this.map(function(entry ) {return [toJS(entry[0]), toJS(entry[1])]}).__toJS(); |
| 4486 | + }; |
| 4487 | + entriesSequence.toJSON = function () { |
| 4488 | + return this.map(function(entry ) {return [toJSON(entry[0]), toJSON(entry[1])]}).__toJS(); |
| 4489 | + }; |
| 4490 | + |
4489 | 4491 | return entriesSequence;
|
4490 | 4492 | },
|
4491 | 4493 |
|
|
4899 | 4901 | return [k, v];
|
4900 | 4902 | }
|
4901 | 4903 |
|
| 4904 | + function toJS(value) { |
| 4905 | + return value && typeof value.toJS === 'function' ? value.toJS() : value; |
| 4906 | + } |
| 4907 | + |
| 4908 | + function toJSON(value) { |
| 4909 | + return value && typeof value.toJSON === 'function' ? value.toJSON() : value; |
| 4910 | + } |
| 4911 | + |
4902 | 4912 | function not(predicate) {
|
4903 | 4913 | return function() {
|
4904 | 4914 | return !predicate.apply(this, arguments);
|
|
0 commit comments