Skip to content

Commit

Permalink
add default tau
Browse files Browse the repository at this point in the history
  • Loading branch information
philihp committed Nov 29, 2022
1 parent 8daf1f5 commit 67bf16c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/__tests__/constants.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import constants, { tau } from '../constants'

describe('constants', () => {
describe('tau', () => {
it('defaults to mu/300', () => {
expect.assertions(1)
expect(tau({})).toBeCloseTo(0.08333333)
})
it('is included in default export', () => {
expect.assertions(1)
expect(constants({}).TAU).toBeCloseTo(0.08333333)
})
})
})
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Options } from './types'

export const z = (options: Options) => options?.z ?? 3
export const mu = (options: Options) => options?.mu ?? 25
export const tau = (options: Options) => options?.tau ?? mu(options) / 300
export const sigma = (options: Options) =>
options?.sigma ?? mu(options) / z(options)

Expand All @@ -15,4 +16,5 @@ export default (options: Options) => ({
BETA: beta(options),
BETASQ: betaSq(options),
Z: z(options),
TAU: tau(options),
})

0 comments on commit 67bf16c

Please sign in to comment.