Skip to content

RoxDevvv/Stringify-Values

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

####Javascript Stringify Values of Array of Objects

/**
* stringify values of object inside array of objects
* @param {array} array of objects
* @returns {Array} array of object with all values as string
*/
const StringifyValue = (array) => {
    return array.map(obj => {
        for (var key in obj) {
            if (obj.hasOwnProperty(key)) {
                if (typeof obj[key] != 'string') { obj[key] = JSON.stringify(obj[key]); }
            }
        }
        return obj;
    });
}

About

Stringify values of object inside array of objects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published