diff options
| author | Priyansh <[email protected]> | 2022-01-20 21:10:08 -0500 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2022-01-20 21:10:08 -0500 |
| commit | 50f62bfddf5c1a90a349427049839bf6f2152e7a (patch) | |
| tree | 3825fc9b0187378fb19188ac8525d78ef7342833 /src | |
| parent | 621385fb42b98eeb44dc11cd7138d3cd3ca31adb (diff) | |
| download | izuku.js-50f62bfddf5c1a90a349427049839bf6f2152e7a.tar.xz izuku.js-50f62bfddf5c1a90a349427049839bf6f2152e7a.zip | |
fix: getting column names with names and reset index function
Diffstat (limited to 'src')
| -rw-r--r-- | src/index.ts | 8 | ||||
| -rw-r--r-- | src/lib/frame.ts | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/index.ts b/src/index.ts index 99119a3..7c10f85 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,12 +37,8 @@ class Izuku { const izSampler = getSingleColumnDetails(this, column); return new Izuku(izSampler.rowd, izSampler.rowh); } else if (Array.isArray(column) || isArrayOfType(column, 'string')) { - if (isArrayOfType(column, 'number')) { - const izSampler = getMultipleColumnDetails(this, column); - return new Izuku(izSampler.rowd, izSampler.rowh); - } else { - throw new Error('Columns must be an array of integers or column names'); - } + const izSampler = getMultipleColumnDetails(this, column); + return new Izuku(izSampler.rowd, izSampler.rowh); } else { throw new Error('Unexpected type of column'); } diff --git a/src/lib/frame.ts b/src/lib/frame.ts index f81141d..aff6d31 100644 --- a/src/lib/frame.ts +++ b/src/lib/frame.ts @@ -26,7 +26,7 @@ export function header( this: Frame, header: Array<string> ): Array<string> | any { - if (!header.length) { + if (!header || header.length) { this.columns = generateHeader(this.rowdata); } else { this.columns = setHeader(this.rowdata, header); |
