Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/node-red/node_modules/@sinonjs/samsam/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
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);
}
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 = "";
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
map.forEach(function (value, key) {
representation += `[${stringify(key)},${stringify(value)}],`;
});
representation = slice(representation, 0, -1);
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 = "";
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
iterable.forEach(function (value) {
representation += `${stringify(value)},`;
});
representation = slice(representation, 0, -1);
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);
}
module.exports = iterableToString;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0187 ]-- |