From 47bc42a1068c214d0f6324a518c82c8c4112c1ff Mon Sep 17 00:00:00 2001 From: VeraZab Date: Thu, 31 May 2018 11:45:21 -0400 Subject: [PATCH 1/2] Adjust transpose function not to eat '0' s --- src/lib/__tests__/transpose-test.js | 4 ++-- src/lib/index.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/__tests__/transpose-test.js b/src/lib/__tests__/transpose-test.js index 46ed03447..6686dc542 100644 --- a/src/lib/__tests__/transpose-test.js +++ b/src/lib/__tests__/transpose-test.js @@ -18,7 +18,7 @@ describe('transpose', () => { }); it('correctly transposes 2d arrays', () => { - const originalArray = [[1, 2, 3], [9, 8, 7]]; + const originalArray = [[1, 2, 3], [9, 8, 0]]; const transposedArray = transpose(originalArray); expect(transposedArray.length).toBe(3); @@ -32,7 +32,7 @@ describe('transpose', () => { expect(transposedArray[1][0]).toBe(2); expect(transposedArray[1][1]).toBe(8); expect(transposedArray[2][0]).toBe(3); - expect(transposedArray[2][1]).toBe(7); + expect(transposedArray[2][1]).toBe(0); }); it('correctly fills non symmetrical 2d arrays', () => { diff --git a/src/lib/index.js b/src/lib/index.js index 17489aea8..619ae35ef 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -95,9 +95,10 @@ function transpose(originalArray) { newArray[innerIndex] = []; } - const value = originalArray[outerIndex][innerIndex] - ? originalArray[outerIndex][innerIndex] - : null; + const value = + typeof originalArray[outerIndex][innerIndex] !== 'undefined' + ? originalArray[outerIndex][innerIndex] + : null; newArray[innerIndex].push(value); } } From 075f965d3474cad598e01ea3105d40fe53872539 Mon Sep 17 00:00:00 2001 From: VeraZab Date: Thu, 31 May 2018 13:38:03 -0400 Subject: [PATCH 2/2] Minor release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f6fbf22bc..73e4ae1b4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-chart-editor", "description": "plotly.js chart editor react component UI", - "version": "0.17.0", + "version": "0.17.1", "author": "Plotly, Inc.", "bugs": { "url": "https://github.com/plotly/react-chart-editor/issues"