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