Comparing version 2.6.4 to 2.7.0
@@ -46,3 +46,3 @@ 'use strict'; | ||
var action = Symbol('action'); | ||
var index = Symbol('index'); | ||
var currentIndex = Symbol('currentIndex'); | ||
var names = Symbol('names'); | ||
@@ -74,6 +74,6 @@ var meta = Symbol('meta'); | ||
if (!Metadata.has(array)) Metadata.set(array, { | ||
index: index, | ||
columns: new Set(Object.keys(index)) | ||
}); | ||
this.actions = actions; | ||
this.index = index; | ||
} | ||
@@ -100,5 +100,5 @@ | ||
if (action) { | ||
return new Dodo(Arrays.get(this), this[meta].index, [].concat(_toConsumableArray(this.actions), [action])); | ||
return new Dodo(Arrays.get(this), this.index, [].concat(_toConsumableArray(this.actions), [action])); | ||
} else { | ||
return new Dodo(Arrays.get(this), this[meta].index, [].concat(_toConsumableArray(this.actions))); | ||
return new Dodo(Arrays.get(this), this.index, [].concat(_toConsumableArray(this.actions))); | ||
} | ||
@@ -116,3 +116,3 @@ } | ||
var _ret = function () { | ||
var I = _this[index]; | ||
var I = _this[currentIndex]; | ||
return { | ||
@@ -133,3 +133,3 @@ v: _this[action]((0, _transducers.filter)(function (row) { | ||
(0, _invariant2.default)((0, _helpers.isfunc)(fn), 'Dodo#filterBy(name, fn) - fn not a function'); | ||
var col = this[index][name]; | ||
var col = this[currentIndex][name]; | ||
return this[action]((0, _transducers.filter)(function (row) { | ||
@@ -149,3 +149,3 @@ return fn(row[col]); | ||
var _ret2 = function () { | ||
var I = _this2[index]; | ||
var I = _this2[currentIndex]; | ||
return { | ||
@@ -166,3 +166,3 @@ v: _this2[action]((0, _transducers.map)(function (row) { | ||
(0, _invariant2.default)(this[meta].columns.has(name), 'Dodo#col(name) — name ' + name + ' not in index'); | ||
var col = this[index][name]; | ||
var col = this[currentIndex][name]; | ||
var fn = (0, _transducers.map)(function (row) { | ||
@@ -191,3 +191,3 @@ return row[col]; | ||
var indices = names.map(function (name) { | ||
return _this3[index][name]; | ||
return _this3[currentIndex][name]; | ||
}); | ||
@@ -321,3 +321,3 @@ var inner = new Function('row', '\n return [' + indices.map(function (i) { | ||
var map = new Map(); | ||
var grouper = (0, _helpers.createGrouper)(map, fn, this[index][name]); | ||
var grouper = (0, _helpers.createGrouper)(map, fn, this[currentIndex][name]); | ||
var array = this.toArray(); | ||
@@ -329,3 +329,3 @@ var len = array.length; | ||
} | ||
map.forEach(arrayToDodo(this[index])); | ||
map.forEach(arrayToDodo(this[currentIndex])); | ||
return Flock(map); | ||
@@ -345,3 +345,3 @@ } | ||
}, { | ||
key: index, | ||
key: currentIndex, | ||
get: function get() { | ||
@@ -352,3 +352,3 @@ var lastMapWithIndex = this.actions.filter(function (act) { | ||
if (lastMapWithIndex.length) return lastMapWithIndex[0].I;else return this[meta].index; | ||
if (lastMapWithIndex.length) return lastMapWithIndex[0].I;else return this.index; | ||
} | ||
@@ -358,3 +358,3 @@ }, { | ||
get: function get() { | ||
var I = this[index]; | ||
var I = this[currentIndex]; | ||
return Object.keys(I).sort(function (a, b) { | ||
@@ -361,0 +361,0 @@ return I[a] - I[b]; |
{ | ||
"name": "dodos", | ||
"version": "2.6.4", | ||
"version": "2.7.0", | ||
"description": "Pandas-inspired iterator-based data wrangling library for js", | ||
@@ -5,0 +5,0 @@ "main": "lib/dodo.js", |
@@ -14,3 +14,3 @@ import invariant from 'invariant' | ||
const action = Symbol('action') | ||
const index = Symbol('index') | ||
const currentIndex = Symbol('currentIndex') | ||
const names = Symbol('names') | ||
@@ -40,6 +40,6 @@ const meta = Symbol('meta') | ||
Metadata.set(array, { | ||
index: index, | ||
columns: new Set(Object.keys(index)), | ||
}) | ||
this.actions = actions | ||
this.index = index | ||
} | ||
@@ -49,3 +49,3 @@ | ||
get [index]() { | ||
get [currentIndex]() { | ||
const lastMapWithIndex = this.actions.filter(act => !!act.I).slice(-1) | ||
@@ -56,7 +56,7 @@ | ||
else | ||
return this[meta].index | ||
return this.index | ||
} | ||
get [names]() { | ||
const I = this[index] | ||
const I = this[currentIndex] | ||
return Object.keys(I).sort((a, b) => I[a] - I[b]) | ||
@@ -86,6 +86,6 @@ } | ||
return new Dodo( | ||
Arrays.get(this), this[meta].index, [...this.actions, action]) | ||
Arrays.get(this), this.index, [...this.actions, action]) | ||
} else { | ||
return new Dodo( | ||
Arrays.get(this), this[meta].index, [...this.actions]) | ||
Arrays.get(this), this.index, [...this.actions]) | ||
} | ||
@@ -99,3 +99,3 @@ } | ||
} else { | ||
const I = this[index] | ||
const I = this[currentIndex] | ||
return this[action](filter(row => fn(row, I))) | ||
@@ -108,3 +108,3 @@ } | ||
invariant(isfunc(fn), `Dodo#filterBy(name, fn) - fn not a function`) | ||
const col = this[index][name] | ||
const col = this[currentIndex][name] | ||
return this[action]( filter(row => fn(row[col])) ) | ||
@@ -118,3 +118,3 @@ } | ||
} else { | ||
const I = this[index] | ||
const I = this[currentIndex] | ||
return this[action](map(row => fn(row, I))) | ||
@@ -128,3 +128,3 @@ } | ||
`Dodo#col(name) — name ${name} not in index`) | ||
const col = this[index][name] | ||
const col = this[currentIndex][name] | ||
const fn = map(row => row[col]) | ||
@@ -142,3 +142,3 @@ fn.I = arrayToIndex([name]) | ||
const indices = names.map(name => this[index][name]) | ||
const indices = names.map(name => this[currentIndex][name]) | ||
const inner = new Function('row', ` | ||
@@ -235,3 +235,3 @@ return [${indices.map(i => `row[${i}]`).join(',')}] | ||
const map = new Map() | ||
const grouper = createGrouper(map, fn, this[index][name]) | ||
const grouper = createGrouper(map, fn, this[currentIndex][name]) | ||
const array = this.toArray() | ||
@@ -243,3 +243,3 @@ const len = array.length | ||
} | ||
map.forEach(arrayToDodo(this[index])) | ||
map.forEach(arrayToDodo(this[currentIndex])) | ||
return Flock(map) | ||
@@ -246,0 +246,0 @@ } |
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
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
107426