/**
* Render all characters of #s as HTML-encoded entities.
- * @param {String} s
- * @returns {string}
+ * @param {string} s string to encode
+ * @returns {string} encoded string
*/
function htmlEncode(s) {
return s
/**
* Convert a number to its Roman representation, using Unicode characters
* or HTML entities.
- * @param {Number} num
- * @param {Boolean} asEntities if true, return html instead of unicode
- * @returns {String}
+ * @param {number} num number to convert
+ * @param {boolean} asEntities if true, return html instead of unicode
+ * @returns {string} roman numeric string
* @throws {RangeError}
*/
function toRoman(num, asEntities = false) {
}
const romanDigits = [];
if (num <= 12) {
- romanDigits.push(singleMapping[num]);
+ romanDigits.push(singleMapping[num]); // eslint-disable-line security/detect-object-injection
} else {
divisors.forEach((d) => {
const length = Math.floor(num / d);
- romanDigits.push(mapping[d].repeat(length));
+ romanDigits.push(mapping[d].repeat(length)); // eslint-disable-line security/detect-object-injection
num %= d;
});
}
module.exports = {
toRoman,
-};
\ No newline at end of file
+};