@data-wrangling-components/utilities
Advanced tools
Comparing version 1.6.3 to 1.6.4
@@ -1,2 +0,2 @@ | ||
import { getDsvFileContent, getJsonFileContentFromFile, getTextFromFile, isDsvFile, isJsonFile, isSupportedFile, isTableFile, isZipFile, loadTable, getDataURL } from '../utils/index.js'; | ||
import { getDataURL, getDsvFileContent, getJsonFileContentFromFile, getTextFromFile, isDsvFile, isJsonFile, isSupportedFile, isTableFile, isZipFile, loadTable } from '../utils/index.js'; | ||
import { FileWithPath } from './FileWithPath.js'; | ||
@@ -3,0 +3,0 @@ export class BaseFile extends FileWithPath { |
@@ -5,4 +5,4 @@ /*! | ||
*/ | ||
export * from './BaseFile.js'; | ||
export * from './FileCollection.js'; | ||
export * from './BaseFile.js'; | ||
export * from './FileWithPath.js'; |
/*! | ||
* Copyright (c) Microsoft. All rights reserved. | ||
* Licensed under the MIT license. See LICENSE file in the project. | ||
*/ export * from './FileCollection.js'; | ||
export * from './BaseFile.js'; | ||
*/ export * from './BaseFile.js'; | ||
export * from './FileCollection.js'; | ||
export * from './FileWithPath.js'; |
@@ -6,3 +6,3 @@ /*! | ||
export * from './common/index.js'; | ||
export * from './types.js'; | ||
export * from './utils/index.js'; | ||
export * from './types.js'; |
@@ -5,3 +5,3 @@ /*! | ||
*/ export * from './common/index.js'; | ||
export * from './types.js'; | ||
export * from './utils/index.js'; | ||
export * from './types.js'; |
@@ -9,5 +9,8 @@ /*! | ||
const delimiter = options.delimiter || guessDelimiter(file.name); | ||
// set a much higher default automax to catch mixed types in large tables | ||
// this has a negligible effect on small tables, and tolerable on large ones | ||
return fromCSV(text, { | ||
...options, | ||
delimiter | ||
delimiter, | ||
autoMax: 1000000, | ||
...options | ||
}); | ||
@@ -14,0 +17,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { BlobReader, ZipReader, BlobWriter, ZipWriter, Data64URIWriter } from '@zip.js/zip.js'; | ||
import { BlobReader, BlobWriter, Data64URIWriter, ZipReader, ZipWriter } from '@zip.js/zip.js'; | ||
import { FileWithPath } from '../common/index.js'; | ||
@@ -3,0 +3,0 @@ export async function getFilesFromZip(zipFile) { |
{ | ||
"name": "@data-wrangling-components/utilities", | ||
"version": "1.6.3", | ||
"version": "1.6.4", | ||
"type": "module", | ||
@@ -16,8 +16,8 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@zip.js/zip.js": "^2.4.5" | ||
"@zip.js/zip.js": "^2.4.6" | ||
}, | ||
"devDependencies": { | ||
"@essex/scripts": "^20.4.6", | ||
"@essex/scripts": "^20.4.9", | ||
"@essex/tsconfig-base": "^1.0.2", | ||
"@essex/vite-config": "^19.0.4", | ||
"@essex/vite-config": "^19.0.5", | ||
"@types/node": "^17.0.21", | ||
@@ -24,0 +24,0 @@ "arquero": "^4.8.8", |
@@ -29,3 +29,3 @@ /*! | ||
describe('BaseFile.name', () => { | ||
it('should get the name of the file', async () => { | ||
it('should get the name of the file', () => { | ||
expect(jsonFile.name).toBe('file.json') | ||
@@ -37,6 +37,6 @@ expect(csvFile.name).toBe('file.csv') | ||
describe('BaseFile.isJson', () => { | ||
it('should return true', async () => { | ||
it('should return true', () => { | ||
expect(jsonFile.isJson()).toBeTruthy() | ||
}) | ||
it('should return false', async () => { | ||
it('should return false', () => { | ||
expect(csvFile.isJson()).toBeFalsy() | ||
@@ -47,6 +47,6 @@ }) | ||
describe('BaseFile.isDsv', () => { | ||
it('should return true', async () => { | ||
it('should return true', () => { | ||
expect(csvFile.isDsv()).toBeTruthy() | ||
}) | ||
it('should return false', async () => { | ||
it('should return false', () => { | ||
expect(jsonFile.isDsv()).toBeFalsy() | ||
@@ -57,6 +57,6 @@ }) | ||
describe('BaseFile.isTable', () => { | ||
it('should return true', async () => { | ||
it('should return true', () => { | ||
expect(csvFile.isTable()).toBeTruthy() | ||
}) | ||
it('should return false', async () => { | ||
it('should return false', () => { | ||
expect(jsonFile.isTable()).toBeFalsy() | ||
@@ -67,7 +67,7 @@ }) | ||
describe('BaseFile.isSupported', () => { | ||
it('should return true', async () => { | ||
it('should return true', () => { | ||
expect(csvFile.isSupported()).toBeTruthy() | ||
expect(jsonFile.isSupported()).toBeTruthy() | ||
}) | ||
it('should return false', async () => { | ||
it('should return false', () => { | ||
xlsxFile = new BaseFile(xlsx) | ||
@@ -79,7 +79,7 @@ expect(xlsxFile.isSupported()).toBeFalsy() | ||
describe('BaseFile.isReadable', () => { | ||
it('should return true', async () => { | ||
it('should return true', () => { | ||
expect(csvFile.isReadable()).toBeTruthy() | ||
expect(jsonFile.isReadable()).toBeTruthy() | ||
}) | ||
it('should return false', async () => { | ||
it('should return false', () => { | ||
expect(xlsxFile.isReadable()).toBeFalsy() | ||
@@ -139,3 +139,3 @@ }) | ||
describe('BaseFile.rename', () => { | ||
it('should rename the file', async () => { | ||
it('should rename the file', () => { | ||
const name = 'newName.xlsx' | ||
@@ -142,0 +142,0 @@ xlsxFile = new BaseFile(xlsx) |
@@ -23,3 +23,3 @@ /*! | ||
describe('new FileCollection()', () => { | ||
it('should create a FileCollection instance', async () => { | ||
it('should create a FileCollection instance', () => { | ||
const instance = new FileCollection() | ||
@@ -31,3 +31,3 @@ expect(instance).toBeInstanceOf(FileCollection) | ||
describe('FileCollection.name', () => { | ||
it('should set the name of the FileCollection', async () => { | ||
it('should set the name of the FileCollection', () => { | ||
expect(fileCollection.name).toBe('') | ||
@@ -40,3 +40,3 @@ fileCollection.name = 'test' | ||
describe('FileCollection.find', () => { | ||
it('should throw an error', async () => { | ||
it('should throw an error', () => { | ||
expect(() => fileCollection.find(file.name)).toThrow( | ||
@@ -46,3 +46,3 @@ `File ${file.name} not found`, | ||
}) | ||
it('should find a file by its name', async () => { | ||
it('should find a file by its name', () => { | ||
fileCollection.add(file) | ||
@@ -54,3 +54,3 @@ expect(fileCollection.find(file.name)).toEqual(file) | ||
describe('FileCollection.setFiles | FileCollection.list()', () => { | ||
it('should set and list the files', async () => { | ||
it('should set and list the files', () => { | ||
const files = [file] | ||
@@ -57,0 +57,0 @@ expect(fileCollection.list()).toEqual([]) |
@@ -7,4 +7,6 @@ /*! | ||
import type ColumnTable from 'arquero/dist/types/table/column-table' | ||
import type { Json } from '../types.js' | ||
import { | ||
getDataURL, | ||
getDsvFileContent, | ||
@@ -19,3 +21,2 @@ getJsonFileContentFromFile, | ||
loadTable, | ||
getDataURL, | ||
} from '../utils/index.js' | ||
@@ -22,0 +23,0 @@ import { FileWithPath } from './FileWithPath.js' |
@@ -8,2 +8,3 @@ /*! | ||
import type ColumnTable from 'arquero/dist/types/table/column-table' | ||
import type { Json } from '../types.js' | ||
@@ -10,0 +11,0 @@ import { FileType } from '../types.js' |
@@ -6,4 +6,4 @@ /*! | ||
export * from './BaseFile.js' | ||
export * from './FileCollection.js' | ||
export * from './BaseFile.js' | ||
export * from './FileWithPath.js' |
@@ -6,3 +6,3 @@ /*! | ||
export * from './common/index.js' | ||
export * from './types.js' | ||
export * from './utils/index.js' | ||
export * from './types.js' |
@@ -6,4 +6,4 @@ /*! | ||
import { BaseFile, FileWithPath } from '../../common/index.js' | ||
import { guessFileType, isDsvFile, isJsonFile, isZipFile } from '..' | ||
import { BaseFile, FileWithPath } from '../../common/index.js' | ||
import { | ||
@@ -10,0 +10,0 @@ extension, |
@@ -7,2 +7,3 @@ /*! | ||
import type { Entry } from '@zip.js/zip.js' | ||
import { FileWithPath } from '../../common/index.js' | ||
@@ -9,0 +10,0 @@ import { getBlobFromEntry, getFileFromEntry, toZip } from '../zip.js' |
@@ -10,2 +10,3 @@ /*! | ||
import type ColumnTable from 'arquero/dist/types/table/column-table' | ||
import type { BaseFile } from '../common/index.js' | ||
@@ -20,3 +21,5 @@ import { getDsvFileContent, guessDelimiter } from './files.js' | ||
const delimiter = options.delimiter || guessDelimiter(file.name) | ||
return fromCSV(text, { ...options, delimiter }) | ||
// set a much higher default automax to catch mixed types in large tables | ||
// this has a negligible effect on small tables, and tolerable on large ones | ||
return fromCSV(text, { delimiter, autoMax: 1000000, ...options }) | ||
} | ||
@@ -23,0 +26,0 @@ |
@@ -187,3 +187,3 @@ /*! | ||
let name = cleanName(file.name) | ||
const count = fileNames[name] as number | ||
const count = fileNames[name] | ||
--fileNames[name] | ||
@@ -190,0 +190,0 @@ if (count > 1) { |
@@ -9,7 +9,8 @@ /*! | ||
BlobReader, | ||
BlobWriter, | ||
Data64URIWriter, | ||
ZipReader, | ||
BlobWriter, | ||
ZipWriter, | ||
Data64URIWriter, | ||
} from '@zip.js/zip.js' | ||
import { FileWithPath } from '../common/index.js' | ||
@@ -16,0 +17,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
96601
1820
Updated@zip.js/zip.js@^2.4.6