bump package version to 1.0.2
[squeep-roman] / index.js
index daed9d7391aad73e9fc743a2d22a93cb3168305f..cfdcd7d5b37ec1a0346ff87a52f4ff725ea71c59 100644 (file)
--- a/index.js
+++ b/index.js
@@ -45,8 +45,8 @@ const mapping = {
 
 /**
  * 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
@@ -68,9 +68,9 @@ const divisors = Object.keys(mapping)
 /**
  * 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) {
@@ -82,11 +82,11 @@ 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;
     });
   }
@@ -97,4 +97,4 @@ function toRoman(num, asEntities = false) {
 
 module.exports = {
   toRoman,
-};
\ No newline at end of file
+};