-
-
Save leepfrog/3557191 to your computer and use it in GitHub Desktop.
This file contains 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
// In this sorting function, we have three indices in our array | |
// a[0] - the name of the injection | |
// a[1] - the name of an injection that THIS injection should be before | |
// a[2] - the name of an injection that THIS injection should be after | |
// When given an array: | |
// [['b', 'c', null], ['a','b', null], ['d', null, 'c'], ['c', null, null], ['e', null, 'd']]; | |
// Then the output from this array should look like: | |
// [['a','b', null], ['b', 'c', null], ['c', null, null], ['d', null, 'c'], ['e', null, 'd']]; | |
// We are assuming: | |
// The injection should either have a before OR an after, not both | |
// If an injection utilizes the same name/object for a before or after target, then the injections should be considered to be un-ordered within that set | |
// Here are the rules for the sort: | |
// #1 an injection with a before target should appear before any other injection | |
// and that injection should appear before it's named target | |
// #2 an injection with an after target should appear after any other injection | |
// and that injection should appear after it's named target | |
var injections = [['b', 'c', null], ['a','b', null], ['d', null, 'c'], ['c', null, null], ['e', null, 'd']]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated so you have a place to track