UNPKG

@paydirt/fmt

Version:

String formating using commonly used standards

10 lines (9 loc) 457 B
import stringReplacer from './string'; export default function (_, mods, value) { if (typeof value === 'string') { var chars = (value.split('') .map(function (char) { return char.charCodeAt(0); })); return stringReplacer('s', mods, chars.map(function (charCode) { return ((charCode >>> 0).toString(2).padStart(8, '0')); }).join(' ')); } return stringReplacer('s', mods, (value >>> 0).toString(2).padStart(8, '0')); }