UNPKG

@nullvoxpopuli/ember-composable-helpers

Version:
24 lines (17 loc) 380 B
import { helper } from '@ember/component/helper'; import { isEmpty } from '@ember/utils'; export function inc([step, val]: [number | undefined, number?]) { if (isEmpty(val)) { val = step; step = undefined; } val = Number(val); if (isNaN(val)) { return; } if (step === undefined) { step = 1; } return val + step; } export default helper(inc);