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
const formatCents = (sum?: number | null): string => | |
sum | |
? (sum / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".").replace(/\.([^.]*)$/g, ",$1") | |
: '0,00'; | |
// Tests: | |
// it('formats cents into EURO (€) values', () => { | |
// expect(formatCents(1)).toEqual('0,01'); | |
// expect(formatCents(10)).toEqual('0,10'); |
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
import * as React from 'react' | |
import { Link as GatsbyLink, GatsbyLinkProps } from 'gatsby' | |
interface Props extends GatsbyLinkProps<HTMLAnchorElement> { | |
to: string | |
className?: string | |
target?: string | |
} | |
const checkLinkType = (to: Props['to']) => { |