Skip to content

Instantly share code, notes, and snippets.

@AlanBreck
Last active December 10, 2016 06:50
Show Gist options
  • Save AlanBreck/abd025698f6919cae4ae3216f8c6d587 to your computer and use it in GitHub Desktop.
Save AlanBreck/abd025698f6919cae4ae3216f8c6d587 to your computer and use it in GitHub Desktop.
const jobsArray = [].slice.call( jobs );
const jobsToInvoice = jobsArray.map( job => ({
name: job.name,
quantity: 1,
unit_price: {
currency: "USD",
value: job.cost
}
}));
/*
* Returns:
ModelArray [
{ name: undefined,
quantity: 1,
unit_price: { currency: 'USD', value: undefined } },
{ name: undefined,
quantity: 1,
unit_price: { currency: 'USD', value: undefined } },
{ name: undefined,
quantity: 1,
unit_price: { currency: 'USD', value: undefined } },
_meta: { total: 0, offset: 0 },
Model: 3 ]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment