Comparing version 2.4.0 to 2.4.1
{ | ||
"name": "dodos", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "Pandas-inspired iterator-based data wrangling library for js", | ||
"main": "dist/dodos.js", | ||
"main": "lib/dodo.js", | ||
"scripts": { | ||
"build": "webpack", | ||
"build": "npm run build:lib && npm run build:umd", | ||
"build:lib": "babel src --out-dir lib", | ||
"build:umd": "webpack", | ||
"clean": "rimraf lib dist coverage .nyc_output", | ||
"test": "ava", | ||
@@ -12,4 +15,9 @@ "test:watch": "ava --watch", | ||
"prepush": "npm test", | ||
"prepublish": "npm test && npm run build" | ||
"prepublish": "npm test && npm run clean && npm run build" | ||
}, | ||
"files": [ | ||
"dist", | ||
"lib", | ||
"src" | ||
], | ||
"repository": { | ||
@@ -40,2 +48,3 @@ "type": "git", | ||
"nyc": "~6.1.1", | ||
"rimraf": "~2.5.2", | ||
"table": "~3.7.8", | ||
@@ -42,0 +51,0 @@ "webpack": "~1.12.14" |
@@ -6,7 +6,7 @@ import invariant from 'invariant' | ||
import flatten from 'lodash/flatten' | ||
import {map, filter, drop, take, seq, transduce} from 'transducers.js' | ||
import {map, filter, drop, take, transduce} from 'transducers.js' | ||
import { | ||
identity, combineReducers, REDUCERS, spread, createGrouper, isfunc, | ||
arrayToIndex, compose | ||
arrayToIndex, compose, transduceNoBreak, arrayReducer | ||
} from './helpers' | ||
@@ -24,2 +24,5 @@ | ||
const needSlowCase = a => | ||
a.toString().includes('new Take') || a.toString().includes('new Drop') | ||
export default class Dodo { | ||
@@ -63,3 +66,8 @@ constructor(array, index, actions=noActions) { | ||
if (this.actions.length) | ||
return seq(Arrays.get(this), compose(this.actions)) | ||
return (this.actions.some(needSlowCase) ? transduce : transduceNoBreak)( | ||
Arrays.get(this), | ||
compose(this.actions), | ||
arrayReducer, | ||
[] | ||
) | ||
else | ||
@@ -154,3 +162,3 @@ return Arrays.get(this) | ||
`Dodo#reduce(fn, init, final) — final not a function`) | ||
return transduce( | ||
return (this.actions.some(needSlowCase) ? transduce : transduceNoBreak)( | ||
Arrays.get(this), | ||
@@ -157,0 +165,0 @@ compose(this.actions), |
import zipObject from 'lodash/zipObject' | ||
export const identity = a => a | ||
export function compose(funcs) { | ||
@@ -26,2 +28,22 @@ var len = funcs.length | ||
export const arrayReducer = { | ||
['@@transducer/result']: identity, | ||
['@@transducer/step'](arr, v) { | ||
arr.push(v) | ||
return arr | ||
}, | ||
} | ||
export function transduceNoBreak(coll, xform, reducer, init) { | ||
xform = xform(reducer) | ||
var result = init; | ||
var index = -1; | ||
var len = coll.length; | ||
while(++index < len) { | ||
result = xform['@@transducer/step'](result, coll[index]); | ||
} | ||
return xform['@@transducer/result'](result); | ||
} | ||
export function combineReducers(fns, spread) { | ||
@@ -48,4 +70,2 @@ const len = fns.length | ||
export const identity = a => a | ||
export const REDUCERS = { | ||
@@ -52,0 +72,0 @@ max: [(max, el) => max > el ? max : el, () => -Infinity, identity], |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
156977
17
8
3174
2