Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let standardKeyWordsResults = (ele && ele.WordStatistic && ele.WordStatistic.StandardKeyWordsResults && ele.WordStatistic.Results) ? ele.WordStatistic.StandardKeyWordsResults : [];
- console.log('abc',standardKeyWordsResults)
- if (standardKeyWordsResults.length > 0) {
- // convert json object into an array to display as a list of key words
- // let keys = Object.keys(standardKeyWordsResults)
- // keys.forEach(key => {
- // if (standardKeyWordsResults[key] === 0) {
- // delete standardKeyWordsResults[key]
- // }
- // })
- let stringifyContent = JSON.stringify(standardKeyWordsResults);
- stringifyContent = stringifyContent.replace(/['"]+/g, ''); // replace double quotes
- stringifyContent = stringifyContent.replace(/[{}]/g, ""); // remove braces
- // set as an array
- let splittedArray = stringifyContent.split(',').filter(elem => elem !== "")
- console.log('abc',splittedArray)
- ele.WordStatistic.StandardKeyWordsResults = splittedArray.length > 0 ? splittedArray : []
- } else {
- ele.WordStatistic.StandardKeyWordsResults = []
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement