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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: utility module flatting and limiting #395

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 46 additions & 8 deletions src/utils/expose.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
export * as Collections from './collection'
export * as Bytes from './bytes'
export * as Data from './data'
export * as File from './file'
export * as Hex from './hex'
export * as Tar from './tar'
export * as Eth from './eth'
export * as Stream from './stream'
export { getCollectionSize, getFolderSize } from './collection'

export {
Bytes,
FlexBytes,
isBytes,
assertBytes,
isFlexBytes,
assertFlexBytes,
bytesAtOffset,
flexBytesAtOffset,
bytesEqual,
} from './bytes'

export {
HexString,
PrefixedHexString,
makeHexString,
hexToBytes,
bytesToHex,
intToHex,
isHexString,
assertHexString,
assertPrefixedHexString,
} from './hex'

export {
EthAddress,
makeEthAddress,
makeHexEthAddress,
isHexEthAddress,
ethToSwarmAddress,
toLittleEndian,
fromLittleEndian,
makeEthereumWalletSigner,
} from './eth'

export {
readableWebToNode,
readableNodeToWeb,
isReadableStream,
isNodeReadable,
normalizeToReadableStream,
isReadable,
} from './stream'

export { keccak256Hash } from './hash'
4 changes: 2 additions & 2 deletions test/unit/utils/collection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ function createFakeFile(): Partial<File> {

describe('collection', () => {
test('should calculate folder size', async () => {
const size = await Utils.Collections.getFolderSize('./test/data')
const size = await Utils.getFolderSize('./test/data')

expect(size).toBeGreaterThan(1)
})

test('should calculate collection size', async () => {
const files: File[] = [createFakeFile() as File]
const size = Utils.Collections.getCollectionSize(files)
const size = Utils.getCollectionSize(files)

expect(size).toBe(32)
})
Expand Down