diff --git a/lib/iterable-to-string.js b/lib/iterable-to-string.js index a5405d5..b8b0c70 100644 --- a/lib/iterable-to-string.js +++ b/lib/iterable-to-string.js @@ -4,6 +4,13 @@ var slice = require("@sinonjs/commons").prototypes.string.slice; var typeOf = require("@sinonjs/commons").typeOf; var valueToString = require("@sinonjs/commons").valueToString; +/** + * Creates a string represenation of an iterable object + * + * @private + * @param {object} obj The iterable object to stringify + * @returns {string} A string representation + */ function iterableToString(obj) { if (typeOf(obj) === "map") { return mapToString(obj); @@ -12,6 +19,13 @@ function iterableToString(obj) { return genericIterableToString(obj); } +/** + * Creates a string representation of a Map + * + * @private + * @param {Map} map The map to stringify + * @returns {string} A string representation + */ function mapToString(map) { var representation = ""; @@ -24,6 +38,13 @@ function mapToString(map) { return representation; } +/** + * Create a string represenation for an iterable + * + * @private + * @param {object} iterable The iterable to stringify + * @returns {string} A string representation + */ function genericIterableToString(iterable) { var representation = ""; @@ -36,6 +57,13 @@ function genericIterableToString(iterable) { return representation; } +/** + * Creates a string representation of the passed `item` + * + * @private + * @param {object} item The item to stringify + * @returns {string} A string representation of `item` + */ function stringify(item) { return typeof item === "string" ? "'" + item + "'" : valueToString(item); }