Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 6, 2022
1 parent 3ad61be commit 31fcdd9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/config/normalize/lib/wild_wild_path/parsing/parse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ESCAPE, SEPARATOR, SPECIAL_CHARS } from '../tokens/escape.js'
import { ESCAPE, TOKEN_SEPARATOR, SPECIAL_CHARS } from '../tokens/escape.js'
import { getStringTokenType } from '../tokens/main.js'

import { normalizePath } from './normalize.js'
Expand Down Expand Up @@ -92,7 +92,7 @@ const parseQuery = function (query) {
// eslint-disable-next-line max-depth
if (char === ESCAPE) {
parseEscape(state, query)
} else if (char === SEPARATOR || state.index === query.length) {
} else if (char === TOKEN_SEPARATOR || state.index === query.length) {
addToken(state)
} else {
state.chars += char
Expand All @@ -103,7 +103,7 @@ const parseQuery = function (query) {
}

const getInitialState = function (query) {
const index = query[0] === SEPARATOR ? 1 : 0
const index = query[0] === TOKEN_SEPARATOR ? 1 : 0
const state = { path: [], index }
resetState(state)
return state
Expand All @@ -120,7 +120,7 @@ const parseEscape = function (state, query) {

if (state.chars.length !== 0) {
throw new Error(
`character "${ESCAPE}" must either be at the start of a token, or be followed by ${SEPARATOR} or ${ESCAPE}`,
`character "${ESCAPE}" must either be at the start of a token, or be followed by ${TOKEN_SEPARATOR} or ${ESCAPE}`,
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/config/normalize/lib/wild_wild_path/parsing/serialize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SEPARATOR } from '../tokens/escape.js'
import { TOKEN_SEPARATOR } from '../tokens/escape.js'
import { getObjectTokenType } from '../tokens/main.js'

import { parse } from './parse.js'
Expand All @@ -12,7 +12,7 @@ export const serialize = function (queryOrPath) {
}

const serializePath = function (path) {
return path.map(serializeToken).join(SEPARATOR)
return path.map(serializeToken).join(TOKEN_SEPARATOR)
}

const serializeToken = function (token, index) {
Expand Down
4 changes: 2 additions & 2 deletions src/config/normalize/lib/wild_wild_path/tokens/escape.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
export const ESCAPE = '\\'

// Tokens separator
export const SEPARATOR = '.'
export const TOKEN_SEPARATOR = '.'

// Special characters to escape
export const SPECIAL_CHARS = new Set([ESCAPE, SEPARATOR])
export const SPECIAL_CHARS = new Set([ESCAPE, TOKEN_SEPARATOR])

// Escape special characters
export const escapeSpecialChars = function (string) {
Expand Down
4 changes: 2 additions & 2 deletions src/config/normalize/lib/wild_wild_path/tokens/prop.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { objectProps } from './common.js'
import { ESCAPE, SEPARATOR, escapeSpecialChars } from './escape.js'
import { ESCAPE, TOKEN_SEPARATOR, escapeSpecialChars } from './escape.js'
import { getOtherStringTokenType } from './other.js'

// Check the type of a parsed token
Expand All @@ -10,7 +10,7 @@ const testObject = function (token) {
// Serialize a token to a string
const serialize = function (token, index) {
if (token === '' && index === 0) {
return SEPARATOR
return TOKEN_SEPARATOR
}

const chars = escapeSpecialChars(token)
Expand Down

0 comments on commit 31fcdd9

Please sign in to comment.