dgeni
Version:
Flexible JavaScript documentation generator used by both AngularJS and Angular
17 lines (16 loc) • 1.25 kB
TypeScript
/**
* @name sortByDependency
* @description Sort a collection of items, such that the items come before
* or after the dependencies defined on the items.
* @param {Array|Object} items The collection of items to sort.
* @param {string} [afterProp] 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.
* @param {string} [beforeProp] 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.
* @param {string} [nameProp='name'] The name of the property on the object that holds its name,
* defaults to 'name'.
* @return {Array} A new array containing the sorted collection of items.
*/
export declare function sortByDependency<T>(items: Record<string, T> | T[], afterProp?: string, beforeProp?: string, nameProp?: string): T[];