Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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']];
Add Comment
Please, Sign In to add comment