Skip to content

Commit

Permalink
Rename array token type to index
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 20, 2022
1 parent 11edc3b commit 87630a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/config/normalize/lib/wild_wild_parser/tokens/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const equals = function (tokenA, tokenB) {
}

export const ARRAY_TOKEN = {
name: 'array',
name: 'index',
testObject,
serialize,
testString,
Expand Down
4 changes: 2 additions & 2 deletions src/config/normalize/lib/wild_wild_parser/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const validateEmptyQuery = function (queryArrays, queryString) {
// Transform a queryArrays into a path, if possible
// Paths are a subset of query strings|arrays which use:
// - No unions
// - Only prop tokens, and array tokens (positive only)
// - Only prop and index tokens (positive only)
// Those are the ones exposed in output, as opposed to query arrays which are
// exposed in input.
export const normalizeArraysPath = function (queryArrays, query) {
Expand Down Expand Up @@ -71,7 +71,7 @@ const validateProp = function (prop, query) {

// Negative indices are not allowed in paths
const isNegativeIndex = function (tokenType, prop) {
return tokenType.name === 'array' && (Object.is(prop, -0) || prop < 0)
return tokenType.name === 'index' && (Object.is(prop, -0) || prop < 0)
}

// Normalize query arrays
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/wild_wild_path/tokens/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getArrayIndex = function (value, token) {
}

export const ARRAY_TOKEN = {
name: 'array',
name: 'index',
array: true,
iterate,
}

0 comments on commit 87630a6

Please sign in to comment.