sortByDependency (sortByDependency.html)
Sort a collection of items, such that the items come before
or after the dependencies defined on the items.
Params
-
items { Array } - The collection of items to sort.
-
afterProp { string } - The name of the property that will hold an array of names of
other items that the item must come after. If it is not
defined then this property is ignored.
-
beforeProp { string } - The name of the property that will hold an array of names of
other items that the item must come before. If it is not
defined then this property is ignored.
-
nameProp { string } - The name of the property on the object that holds its name,
defaults to 'name'.
Returns
{ Array } - A new array containing the sorted collection of items.