Skip to content

Instantly share code, notes, and snippets.

@smallfx
Last active March 17, 2017 19:39
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 smallfx/d383691b2cdf55a45c3f1f2940892a34 to your computer and use it in GitHub Desktop.
Save smallfx/d383691b2cdf55a45c3f1f2940892a34 to your computer and use it in GitHub Desktop.
// functionally "push" values from an Array onto an Object with UUID as key
import _ from 'lodash';
import uuid from 'uuid';
let oldguy = { "pretend-uuid": 9001 };
let values = [1, 2, 3];
Object.assign({}, oldguy, _.fromPairs(
_.map(values, (value) => [uuid(), value])
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment