Skip to content

Commit fe90a0e

Browse files
committed
Auto-generated commit
1 parent bac0d3a commit fe90a0e

File tree

5 files changed

+41
-6
lines changed

5 files changed

+41
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@
150150

151151
### Bug Fixes
152152

153+
- [`d3b0f25`](https://github.com/stdlib-js/stdlib/commit/d3b0f251b37fdc27cd3a02ac794dddba0b2f7b36) - correct loop bounds in toJSON method for `nested2views`
154+
- [`fbc5910`](https://github.com/stdlib-js/stdlib/commit/fbc5910c2290928c2fdc730a6b166b39e637d304) - remove unnecessary loop in toJSON method for entries2views
153155
- [`8cdfd62`](https://github.com/stdlib-js/stdlib/commit/8cdfd621717a7a41428526107a42364a921b07ae) - ensure proper cache invalidation
154156
- [`f53879d`](https://github.com/stdlib-js/stdlib/commit/f53879de98a2f80792d3d97c7748fd7425800aac) - ensure support for outer accessor arrays
155157
- [`5741019`](https://github.com/stdlib-js/stdlib/commit/57410198f53879784c97784af6bbe0b482b235ae) - ensure accessor support for provided fields
@@ -242,6 +244,8 @@ A total of 32 issues were closed in this release:
242244

243245
<details>
244246

247+
- [`d3b0f25`](https://github.com/stdlib-js/stdlib/commit/d3b0f251b37fdc27cd3a02ac794dddba0b2f7b36) - **fix:** correct loop bounds in toJSON method for `nested2views` _(by Philipp Burckhardt)_
248+
- [`fbc5910`](https://github.com/stdlib-js/stdlib/commit/fbc5910c2290928c2fdc730a6b166b39e637d304) - **fix:** remove unnecessary loop in toJSON method for entries2views _(by Philipp Burckhardt)_
245249
- [`8cdfd62`](https://github.com/stdlib-js/stdlib/commit/8cdfd621717a7a41428526107a42364a921b07ae) - **fix:** ensure proper cache invalidation _(by Athan Reines)_
246250
- [`d5a7391`](https://github.com/stdlib-js/stdlib/commit/d5a73912f19ca4825ce2f361fa4a37d193030ee3) - **feat:** add `rekey` to namespace _(by Athan Reines)_
247251
- [`74dc3c3`](https://github.com/stdlib-js/stdlib/commit/74dc3c37f9b0c66051ba2ab143035cb3a4460970) - **feat:** add `array/base/rekey` _(by Athan Reines)_

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Oneday12323 <[email protected]>
133133
Ori Miles <[email protected]>
134134
Philipp Burckhardt <[email protected]>
135135
Pierre Forstmann <[email protected]>
136+
Pradyumn Prasad <[email protected]>
136137
Prajjwal Bajpai <[email protected]>
137138
Prajwal Kulkarni <[email protected]>
138139
Pranav Goswami <[email protected]>

base/entries2views/lib/main.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,10 @@ function entries2views( arr, fields ) {
165165
*/
166166
function toJSON() {
167167
var out;
168-
var i;
169168

170169
out = {};
171-
for ( i = 0; i < N; i++ ) {
172-
out[ k ] = this[ k ];
173-
out[ v ] = this[ v ];
174-
}
170+
out[ k ] = this[ k ];
171+
out[ v ] = this[ v ];
175172
return out;
176173
}
177174
}

base/nested2views/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function nested2views( arr, fields ) {
204204
var i;
205205

206206
out = {};
207-
for ( i = 0; i < M; i++ ) {
207+
for ( i = 0; i < N; i++ ) {
208208
k = keys[ i ];
209209
out[ k ] = this[ k ];
210210
}

base/nested2views/test/test.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,36 @@ tape( 'the function supports outer array mutation (accessors)', function test( t
289289

290290
t.end();
291291
});
292+
293+
tape( 'the returned views have a toJSON method which includes all fields', function test( t ) {
294+
var expected;
295+
var actual;
296+
var fields;
297+
var x;
298+
299+
fields = [ 'a', 'b', 'c', 'd', 'e' ];
300+
301+
x = [ [ 1, 2, 3, 4, 5 ], [ 6, 7, 8, 9, 10 ] ];
302+
303+
actual = nested2views( x, fields );
304+
305+
expected = {
306+
'a': 1,
307+
'b': 2,
308+
'c': 3,
309+
'd': 4,
310+
'e': 5
311+
};
312+
t.deepEqual( actual[ 0 ].toJSON(), expected, 'returns expected value for first element' );
313+
314+
expected = {
315+
'a': 6,
316+
'b': 7,
317+
'c': 8,
318+
'd': 9,
319+
'e': 10
320+
};
321+
t.deepEqual( actual[ 1 ].toJSON(), expected, 'returns expected value for second element' );
322+
323+
t.end();
324+
});

0 commit comments

Comments
 (0)