Skip to content

Instantly share code, notes, and snippets.

@klochner
Last active March 18, 2016 18:05
Show Gist options
  • Save klochner/9f8080712edc575646e5 to your computer and use it in GitHub Desktop.
Save klochner/9f8080712edc575646e5 to your computer and use it in GitHub Desktop.
const merge = (a1, a2) => {
const a22 = a2.slice();
return a1.reduce((out, e) => {
const index = a22.findIndex((i) => {return i > e});
return out.concat(a22.splice(0,index)).concat([e]);
}, []).concat(a22);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment