Skip to content

Commit

Permalink
Rename bigInt() to bigint()
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-ka committed Mar 23, 2023
1 parent 4d4e76b commit b9f8886
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import * as E from 'fp-ts/Either';
import { DecodeFailed } from '../EnvironmentError';
import { Variable } from '../Variable';

import { bigInt } from './bigInt';
import { bigint } from './bigint';

describe(bigInt, () => {
describe(bigint, () => {
it('accepts an arbitrary bigint', () => {
fc.assert(
fc.property(fc.bigInt(), (n) => {
const variable = new Variable('KEY', String(n));
expect(bigInt()(variable)).toStrictEqual(E.right(n));
expect(bigint()(variable)).toStrictEqual(E.right(n));
}),
);
});
Expand All @@ -25,7 +25,7 @@ describe(bigInt, () => {
fc.bigInt().filter((n) => n <= max),
(n) => {
const variable = new Variable('KEY', String(n));
expect(bigInt({ max: 42n })(variable)).toStrictEqual(E.right(n));
expect(bigint({ max: 42n })(variable)).toStrictEqual(E.right(n));
},
),
);
Expand All @@ -37,7 +37,7 @@ describe(bigInt, () => {
fc.bigInt().filter((n) => n > 42),
(n) => {
const variable = new Variable('KEY', String(n));
expect(bigInt({ max: 42n })(variable)).toStrictEqual(
expect(bigint({ max: 42n })(variable)).toStrictEqual(
E.left(new DecodeFailed(variable, 'must be smaller than or equal to 42')),
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Options = {
/**
* Decodes a bigint.
*/
const bigInt = (options: Options = {}): VariableDecoder<bigint> =>
const bigint = (options: Options = {}): VariableDecoder<bigint> =>
pipe(
asks((x) => O.tryCatch(() => BigInt(x))),
RE.chain(unwrap('must be a valid bigint')),
Expand All @@ -30,4 +30,4 @@ const bigInt = (options: Options = {}): VariableDecoder<bigint> =>
),
);

export { bigInt };
export { bigint };
2 changes: 1 addition & 1 deletion src/VariableDecoder/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { base64 } from './base64';
export { bigInt } from './bigInt';
export { bigint } from './bigint';
export { boolean } from './boolean';
export { hex } from './hex';
export { host } from './host';
Expand Down

0 comments on commit b9f8886

Please sign in to comment.