oct.js (894B)
1 import { factory } from '../../utils/factory.js'; 2 var name = 'oct'; 3 var dependencies = ['typed', 'format']; 4 /** 5 * Format a number as octal. 6 * 7 * Syntax: 8 * 9 * math.oct(value) 10 * 11 * Examples: 12 * 13 * //the following outputs "0o70" 14 * math.oct(56) 15 * 16 * See also: 17 * 18 * bin 19 * hex 20 * 21 * @param {number} value Value to be stringified 22 * @param {number} wordSize Optional word size (see `format`) 23 * @return {string} The formatted value 24 */ 25 26 export var createOct = factory(name, dependencies, _ref => { 27 var { 28 typed, 29 format 30 } = _ref; 31 return typed(name, { 32 'number | BigNumber': function numberBigNumber(n) { 33 return format(n, { 34 notation: 'oct' 35 }); 36 }, 37 'number | BigNumber, number': function numberBigNumberNumber(n, wordSize) { 38 return format(n, { 39 notation: 'oct', 40 wordSize: wordSize 41 }); 42 } 43 }); 44 });