From 2dc7a4b65814913daf1e6576cf7186a56b90d469 Mon Sep 17 00:00:00 2001 From: jorisre Date: Sat, 6 Feb 2021 09:16:24 +0100 Subject: [PATCH] refactor: remove convertArrayToPathName --- src/__tests__/convertArrayToPathName.ts | 11 ----------- src/convertArrayToPathName.ts | 12 ------------ src/index.ts | 1 - 3 files changed, 24 deletions(-) delete mode 100644 src/__tests__/convertArrayToPathName.ts delete mode 100644 src/convertArrayToPathName.ts diff --git a/src/__tests__/convertArrayToPathName.ts b/src/__tests__/convertArrayToPathName.ts deleted file mode 100644 index 7e30b66f..00000000 --- a/src/__tests__/convertArrayToPathName.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { convertArrayToPathName } from '..'; - -describe('convertArrayToPathName', () => { - it('should convert into path name', () => { - expect(convertArrayToPathName(['test', 2])).toEqual('test[2]'); - expect(convertArrayToPathName(['test', 2, 'test'])).toEqual('test[2].test'); - expect(convertArrayToPathName(['test', 2, 'test', 4, 'data'])).toEqual( - 'test[2].test[4].data', - ); - }); -}); diff --git a/src/convertArrayToPathName.ts b/src/convertArrayToPathName.ts deleted file mode 100644 index dbc2c99b..00000000 --- a/src/convertArrayToPathName.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const convertArrayToPathName = (paths: (string | number)[]): string => - paths - .reduce( - (previous, path: string | number, index): string => - `${previous}${ - typeof path === 'string' - ? `${index > 0 ? '.' : ''}${path}` - : `[${path}]` - }`, - '', - ) - .toString(); diff --git a/src/index.ts b/src/index.ts index dc3c3311..3e3a504b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1 @@ -export * from './convertArrayToPathName'; export * from './toNestError';