graphology-utils
Advanced tools
Comparing version 2.4.2 to 2.4.3
@@ -13,2 +13,7 @@ import Graph, {Attributes, NodeMapper, EdgeMapper} from 'graphology-types'; | ||
export type MinimalEdgeMapper< | ||
T, | ||
EdgeAttributes extends Attributes = Attributes | ||
> = (edge: string, attributes: EdgeAttributes) => T; | ||
interface NodeValueGetter<T, NodeAttributes extends Attributes = Attributes> { | ||
@@ -44,2 +49,3 @@ fromGraph(graph: Graph<NodeAttributes>, node: unknown): T; | ||
fromPartialEntry: PartialEdgeMapper<T, EdgeAttributes>; | ||
fromMinimalEntry: MinimalEdgeMapper<T, EdgeAttributes>; | ||
} | ||
@@ -68,3 +74,2 @@ | ||
export function createEdgeWeightGetter< | ||
T, | ||
NodeAttributes extends Attributes = Attributes, | ||
@@ -77,2 +82,2 @@ EdgeAttributes extends Attributes = Attributes | ||
| PartialEdgeMapper<number, EdgeAttributes> | ||
): EdgeValueGetter<T, NodeAttributes, EdgeAttributes>; | ||
): EdgeValueGetter<number, NodeAttributes, EdgeAttributes>; |
@@ -92,2 +92,3 @@ /** | ||
getter.fromPartialEntry = getter.fromEntry; | ||
getter.fromMinimalEntry = getter.fromEntry; | ||
} else if (typeof nameOrFunction === 'function') { | ||
@@ -120,2 +121,5 @@ getter.fromAttributes = function () { | ||
}; | ||
getter.fromMinimalEntry = function (e, a) { | ||
return coerceToDefault(nameOrFunction(e, a)); | ||
}; | ||
} else { | ||
@@ -125,2 +129,3 @@ getter.fromAttributes = returnDefault; | ||
getter.fromEntry = returnDefault; | ||
getter.fromMinimalEntry = returnDefault; | ||
} | ||
@@ -127,0 +132,0 @@ |
{ | ||
"name": "graphology-utils", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"description": "Miscellaneous utils for graphology.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,22 +13,22 @@ # Graphology Utils | ||
*Assertions* | ||
_Assertions_ | ||
* [#.isGraph](#isgraph) | ||
* [#.isGraphConstructor](#isgraphconstructor) | ||
- [#.isGraph](#isgraph) | ||
- [#.isGraphConstructor](#isgraphconstructor) | ||
*Introspection* | ||
_Introspection_ | ||
* [#.inferType](#infertype) | ||
- [#.inferType](#infertype) | ||
*Typical edge patterns* | ||
_Typical edge patterns_ | ||
* [#.mergeClique](#mergeclique) | ||
* [#.mergeCycle](#mergecycle) | ||
* [#.mergePath](#mergepath) | ||
* [#.mergeStar](#mergestar) | ||
- [#.mergeClique](#mergeclique) | ||
- [#.mergeCycle](#mergecycle) | ||
- [#.mergePath](#mergepath) | ||
- [#.mergeStar](#mergestar) | ||
*Miscellaneous helpers* | ||
_Miscellaneous helpers_ | ||
* [#.renameGraphKeys](#renamegraphkeys) | ||
* [#.updateGraphKeys](#updategraphkeys) | ||
- [#.renameGraphKeys](#renamegraphkeys) | ||
- [#.updateGraphKeys](#updategraphkeys) | ||
@@ -74,5 +74,5 @@ ### #.inferType | ||
*Arguments* | ||
_Arguments_ | ||
* **value** *any*: value to test. | ||
- **value** _any_: value to test. | ||
@@ -99,5 +99,5 @@ ### #.isGraphConstructor | ||
*Arguments* | ||
_Arguments_ | ||
* **value** *any*: value to test. | ||
- **value** _any_: value to test. | ||
@@ -121,3 +121,2 @@ ### #.mergeClique | ||
### #.mergeCycle | ||
@@ -140,6 +139,6 @@ | ||
*Arguments* | ||
_Arguments_ | ||
* **graph** *Graph*: target graph. | ||
* **cycle** *array*: array of nodes representing the cycle to add. | ||
- **graph** _Graph_: target graph. | ||
- **cycle** _array_: array of nodes representing the cycle to add. | ||
@@ -163,6 +162,6 @@ ### #.mergePath | ||
*Arguments* | ||
_Arguments_ | ||
* **graph** *Graph*: target graph. | ||
* **path** *array*: array of nodes representing the path to add. | ||
- **graph** _Graph_: target graph. | ||
- **path** _array_: array of nodes representing the path to add. | ||
@@ -186,6 +185,6 @@ ### #.mergeStar | ||
*Arguments* | ||
_Arguments_ | ||
* **graph** *Graph*: target graph. | ||
* **star** *array*: array of nodes representing the star to add. | ||
- **graph** _Graph_: target graph. | ||
- **star** _array_: array of nodes representing the star to add. | ||
@@ -222,7 +221,7 @@ ### #.renameGraphKeys | ||
*Arguments* | ||
_Arguments_ | ||
* **graph** *Graph*: target graph. | ||
* **nodeKeyMapping** *object*: A key/value map for the node key mapping. | ||
* **edgeKeyMapping** *?object*: A key/value map for the edge key mapping. | ||
- **graph** _Graph_: target graph. | ||
- **nodeKeyMapping** _object_: A key/value map for the node key mapping. | ||
- **edgeKeyMapping** _?object_: A key/value map for the edge key mapping. | ||
@@ -266,6 +265,6 @@ ### #.updateGraphKeys | ||
*Arguments* | ||
_Arguments_ | ||
* **graph** *Graph*: target graph. | ||
* **nodeKeyUdater** *function*: A function to compute a new node key from the same arguments that would be given to [`#.forEachNode`](https://graphology.github.io/iteration.html#foreachnode). | ||
* **edgeKeyUpdater** *function*: A function to compute a new edge key from the same arguments that would be given to [`#.forEachEdge`](https://graphology.github.io/iteration.html#foreachedge). | ||
- **graph** _Graph_: target graph. | ||
- **nodeKeyUdater** _function_: A function to compute a new node key from the same arguments that would be given to [`#.forEachNode`](https://graphology.github.io/iteration.html#foreachnode). | ||
- **edgeKeyUpdater** _function_: A function to compute a new edge key from the same arguments that would be given to [`#.forEachEdge`](https://graphology.github.io/iteration.html#foreachedge). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29210
699
262