regstr
Version:
JSON.stringify objects with RegExp properties and then JSON.parse json string resulted back into original objects. Converts RegExp object to be serializable - into pair of strings (key,value). Could be used for RegExp being bilaterally stringified and ge
20 lines (19 loc) • 676 B
JavaScript
/**
* shows list of testing entities in console output. Testing applied utility.
* @param {Array<number|RegExp|Array<any>|Object>} oTst array of testing
* entities specified
* @return {void}
*/
exports.showTestEntities=function (oTst){
// calculates the longest string among first string-elements to form
// the first column of output layout
var m=0; oTst.forEach((e,i) => {if (e[0].length>m) {m=e[0].length}});
/**
* prints output table */
oTst.forEach( e => {
var k=m-e[0].length;
var f = ()=>{var s=" ";return ()=> s=s+" "};f1=f();for(i=0; i<=k; i++){var ss=f1()};
console.log( e[0] + ss +":",e[1]);
});
return;
}