Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function parseData(str, callback) {
- function recursiveFunction(obj) {
- var keysArray = Object.keys(obj);
- for (var i = 0; i < keysArray.length; i++) {
- var key = keysArray[i];
- var value = obj[key];
- if (value === Object(value)) {
- recursiveFunction(value);
- }
- else {
- if (key == 'title') {
- var title = value;
- }
- if (key == 'extract') {
- var extract = value.replace(/(rn|n|r)/gm," ");
- callback(null, JSON.stringify({title: title, text: extract}));
- }
- }
- }
- }
- recursiveFunction(str, callback(null, JSON.stringify({title: title, text: extract})));
- };
- /parseData.js:29
- recursiveFunction(str, callback(null, JSON.stringify({title: title, text: extract})));
- ^
- ReferenceError: title is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement