Skip to content
  • 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);
  • Updated (/un)flatten(/all) so they are not Object.<> but are direct functions. Better because we shouldn't mess with Object and it also works better in the utils.unstable class.

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment