Skip to content

Commit

Permalink
Move lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 6, 2022
1 parent bc58018 commit 0922f10
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/config/normalize/lib/star_dot_path/parsing/tokens/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
// We allow negative indexes which query from the end
// - Including -0 which can be used to append values
// At evaluation time, with a target value, we transtype correctly.
// Check if token is an array index integer
export const isIndexToken = function (token) {
return Number.isInteger(token)
}

// Serialize an array index token into a string
export const serializeIndexToken = function (token) {
return Object.is(token, -0) ? '-0' : String(token)
}

export const convertIndexInteger = function (token) {
return typeof token === 'string' && INTEGER_REGEXP.test(token)
? Number(token)
Expand All @@ -32,13 +42,3 @@ export const getArrayIndex = function (array, token) {
? token
: Math.max(array.length + token, 0)
}

// Check if token is an array index integer
export const isIndexToken = function (token) {
return Number.isInteger(token)
}

// Serialize an array index token into a string
export const serializeIndexToken = function (token) {
return Object.is(token, -0) ? '-0' : String(token)
}

0 comments on commit 0922f10

Please sign in to comment.