-
Examples for using these:
// fetch survey so we can save CFDN labels (rather than value) let thisSurvey = await fetch(`https://app.surveystack.io/api/surveys/62d02e2242548e0001266049`) .then(data => data.json()) ; let resources = Object.flattenAll(thisSurvey.resources); let revision = Object.flattenAll(thisSurvey.revisions[thisSurvey.revisions.length - 1]); // only keep .value and .label to minimize search effort Object.keys(revision).forEach((key) => { if (!/(\.source\.([0-9]+)\.(label|value))+/g.test(key)) delete revision[key]; }) console.log('resources'); console.log(resources); console.log('revision'); console.log(revision);
Please register or sign in to comment