Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(babel): cumsum #230

Closed
theonetheycallneo opened this issue Aug 26, 2021 · 1 comment
Closed

fix(babel): cumsum #230

theonetheycallneo opened this issue Aug 26, 2021 · 1 comment

Comments

@theonetheycallneo
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch d3-array@2.12.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/d3-array/dist/d3-array.js b/node_modules/d3-array/dist/d3-array.js
index ec6ae78..afd592b 100644
--- a/node_modules/d3-array/dist/d3-array.js
+++ b/node_modules/d3-array/dist/d3-array.js
@@ -134,11 +134,18 @@ function cross(...values) {
 }
 
 function cumsum(values, valueof) {
-  var sum = 0, index = 0;
-  return Float64Array.from(values, valueof === undefined
-    ? v => (sum += +v || 0)
-    : v => (sum += +valueof(v, index++, values) || 0));
-}
+  let fn = (v) => (sum += +valueof(v, index++, values) || 0)
+  if (valueof === undefined) fn = (v) => (sum += +v || 0)
+  var sum = 0,
+    index = 0
+  return Float64Array.from(values, fn)
+}
+// function cumsum(values, valueof) {
+//   var sum = 0, index = 0;
+//   return Float64Array.from(values, valueof === undefined
+//     ? v => (sum += +v || 0)
+//     : v => (sum += +valueof(v, index++, values) || 0));
+// }
 
 function descending(a, b) {
   return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;

This issue body was partially generated by patch-package.

@mbostock
Copy link
Member

Duplicate of #147.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants