blob: a0471a5e395bc9b12141d9ab3bcb3651f1625c7b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import { BigNumber } from '@0x/utils';
import { ValueTransformer } from 'typeorm/decorator/options/ValueTransformer';
export class BigNumberTransformer implements ValueTransformer {
// tslint:disable-next-line:prefer-function-over-method
public to(value: BigNumber): string {
return value.toString();
}
// tslint:disable-next-line:prefer-function-over-method
public from(value: string): BigNumber {
return new BigNumber(value);
}
}
export const bigNumberTransformer = new BigNumberTransformer();
|