set selected tech

node v10.24.1
version: 1.0.0
endpointsharetweet
const { compose, find, propEq, pathOr, forEach } = require('ramda'); const tis = { technologiesList: [{id:1, name: 'a'},{id:2, name: 'b'}]}; const newGroup = { technology: [1,3]}; const list = pathOr([], ['technologiesList'])(tis); const setSelectedTechnology = compose( (found) => found ? found.selected = true : {} , (technology) => find(propEq('id')(technology))(list) ); forEach(setSelectedTechnology)(newGroup.technology); console.log(tis.technologiesList);
Loading…

no comments

    sign in to comment