Skip to content

Commit

Permalink
Return index getting key node in map
Browse files Browse the repository at this point in the history
  • Loading branch information
kekavc24 committed Jul 1, 2024
1 parent 647329c commit 502fa0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/src/equality.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ int deepHashCode(Object? value) {
}

/// Returns the [YamlNode] corresponding to the provided [key].
YamlNode getKeyNode(YamlMap map, Object? key) {
return map.nodes.keys.firstWhere((node) => deepEquals(node, key)) as YamlNode;
(int index, YamlNode keyNode) getKeyNode(YamlMap map, Object? key) {
return map.nodes.keys.indexed.firstWhere(
(value) => deepEquals(value.$2, key),
) as (int, YamlNode);
}

/// Returns the [YamlNode] after the [YamlNode] corresponding to the provided
Expand Down

0 comments on commit 502fa0a

Please sign in to comment.