Changes "indexes" to "indices"

This commit is contained in:
neuroevolutus 2023-03-12 12:35:33 -05:00
parent a1ac5b6df5
commit ddbed76e45
5 changed files with 7 additions and 6 deletions

View File

@ -67,7 +67,8 @@ a: 1
b: 2
```
## from_entries with numeric key indexes
## from_entries with numeric key indices
from_entries always creates a map, even for numeric keys
Given a sample.yml file of:

View File

@ -27,7 +27,7 @@ myMap:
```
## Pick indices from array
Note that the order of the indexes matches the pick order and non existent indexes are skipped.
Note that the order of the indices matches the pick order and non existent indices are skipped.
Given a sample.yml file of:
```yaml

View File

@ -36,7 +36,7 @@ var entriesOperatorScenarios = []expressionScenario{
},
},
{
description: "from_entries with numeric key indexes",
description: "from_entries with numeric key indices",
subdescription: "from_entries always creates a map, even for numeric keys",
document: `[a,b]`,
expression: `to_entries | from_entries`,

View File

@ -34,7 +34,7 @@ var pickOperatorScenarios = []expressionScenario{
},
{
description: "Pick indices from array",
subdescription: "Note that the order of the indexes matches the pick order and non existent indexes are skipped.",
subdescription: "Note that the order of the indices matches the pick order and non existent indices are skipped.",
document: `[cat, leopard, lion]`,
expression: `pick([2, 0, 734, -5])`,
expected: []string{

View File

@ -89,7 +89,7 @@ func traverseArrayOperator(d *dataTreeNavigator, context Context, expressionNode
return Context{}, err
}
// rhs is a collect expression that will yield indexes to retrieve of the arrays
// rhs is a collect expression that will yield indices to retrieve of the arrays
rhs, err := d.GetMatchingNodes(context.ReadOnlyClone(), expressionNode.RHS)
@ -267,7 +267,7 @@ func traverseMap(context Context, matchingNode *CandidateNode, keyNode *yaml.Nod
func doTraverseMap(newMatches *orderedmap.OrderedMap, candidate *CandidateNode, wantedKey string, prefs traversePreferences, splat bool) error {
// value.Content is a concatenated array of key, value,
// so keys are in the even indexes, values in odd.
// so keys are in the even indices, values in odd.
// merge aliases are defined first, but we only want to traverse them
// if we don't find a match directly on this node first.