Created
May 26, 2016 12:58
-
-
Save stephenplusplus/d89029800b60a656c4cb2d2ca0f6655e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var flatten = require('lodash.flatten') | |
var prop = require('propprop') | |
var requests = [ | |
{ | |
mutations: [ | |
{ a: 'b' }, | |
{ c: 'd' } | |
] | |
}, | |
{ | |
mutations: [ | |
{ e: 'f' }, | |
{ g: 'h' } | |
] | |
} | |
] | |
var reqOpts = { | |
mutations: flatten(requests.map(prop('mutations'))) | |
} | |
assert.deepEqual(reqOpts, { | |
mutations: [ | |
{ a: 'b' }, | |
{ c: 'd' }, | |
{ e: 'f' }, | |
{ g: 'h' } | |
] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment