-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pretified and fixed datetime miliseconds issue
- Loading branch information
Showing
23 changed files
with
1,192 additions
and
856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"printWidth": 100, | ||
"trailingComma": "none", | ||
"arrowParens": "avoid", | ||
"parser": "typescript", | ||
"singleQuote": true, | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import { Selector } from "./types"; | ||
import { dateToString } from "./utils"; | ||
import { Selector } from './types'; | ||
import { dateToString } from './utils'; | ||
|
||
export function fieldSelector(input: string | string[] | Selector<any, string>): Selector<any, string> { | ||
if (typeof input === "function") { | ||
return input; | ||
} else if (typeof input === "string") { | ||
return (item): any => item[input] instanceof Date ? dateToString(item[input]) : item[input]; | ||
} else if (Array.isArray(input)) { | ||
return (item): any => input.map(r => item[r]).join('|'); | ||
} else { | ||
throw Error(`Unknown input. Can't create a fieldSelector`) | ||
} | ||
} | ||
export function fieldSelector( | ||
input: string | string[] | Selector<any, string> | ||
): Selector<any, string> { | ||
if (typeof input === 'function') { | ||
return input; | ||
} else if (typeof input === 'string') { | ||
return (item): any => (item[input] instanceof Date ? dateToString(item[input]) : item[input]); | ||
} else if (Array.isArray(input)) { | ||
return (item): any => input.map(r => item[r]).join('|'); | ||
} else { | ||
throw Error(`Unknown input. Can't create a fieldSelector`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export * from './joins' | ||
export * from './stats' | ||
export * from './transform' | ||
export * from './utils' | ||
export * from './joins'; | ||
export * from './stats'; | ||
export * from './transform'; | ||
export * from './utils'; |
Oops, something went wrong.