aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/core-utils/common/number.ts
blob: ce5a6041a4fad2ec33d7db57cbf6f1d7d355c733 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
export function forceNumber (value: any) {
  return parseInt(value + '')
}

export function isOdd (num: number) {
  return (num % 2) !== 0
}

export function toEven (num: number) {
  if (isOdd(num)) return num + 1

  return num
}