Skip to content

Instantly share code, notes, and snippets.

@Oziabr
Created June 2, 2017 10:48
Show Gist options
  • Save Oziabr/3b53102d3031444ded8a6df440a8a132 to your computer and use it in GitHub Desktop.
Save Oziabr/3b53102d3031444ded8a6df440a8a132 to your computer and use it in GitHub Desktop.
angular2 resolver helper
let resolver = (sbj, ctx = {}) => Observable.zip( ...Object.keys(sbj).map(k => sbj[k]), (...args) =>
args.reduce((r, a, n) => Object.defineProperty(r, Object.keys(sbj)[n], {value: a, enumerable: true})
, ctx))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment