Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosminpopescu14/a5a00f648a7c0d07a65ddd3b27493a9e to your computer and use it in GitHub Desktop.
Save cosminpopescu14/a5a00f648a7c0d07a65ddd3b27493a9e to your computer and use it in GitHub Desktop.
let _ = require('underscore');
let data = [ { Data: 2019, IdJudet: "09,18" }, { Data: 2019, IdJudet: "09,18, 20, 03" }, { Data: 2019, IdJudet: "09" }, { Data: 2019, IdJudet: null } ]
let collectedData = _.collect(data)
let counties = _.pluck(collectedData, 'IdJudet').join(',').replace(/\s+/g, '')
let noDupesCounties = _.uniq(counties.split(',').filter(Boolean))
console.log(noDupesCounties)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment