Skip to content

Instantly share code, notes, and snippets.

@nummi
Created February 12, 2019 20:42
Show Gist options
  • Save nummi/9d75ef602950fad31b29b5af7347d2c8 to your computer and use it in GitHub Desktop.
Save nummi/9d75ef602950fad31b29b5af7347d2c8 to your computer and use it in GitHub Desktop.
import { helper } from '@ember/component/helper';
import { htmlSafe } from '@ember/string';
export function matchDigits([value, max, pad]) {
max = max.toString();
value = value.toString();
return htmlSafe(
value.length >= max.length ? value : new Array(max.length - value.length + 1).join(pad) + value
);
}
export default helper(matchDigits);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment