mirror of
https://github.com/voson-wang/toon.git
synced 2026-01-29 23:34:10 +08:00
refactor: move encode functions
This commit is contained in:
@@ -5,8 +5,8 @@ import type {
|
|||||||
JsonPrimitive,
|
JsonPrimitive,
|
||||||
JsonValue,
|
JsonValue,
|
||||||
ResolvedEncodeOptions,
|
ResolvedEncodeOptions,
|
||||||
} from './types'
|
} from '../types'
|
||||||
import { LIST_ITEM_MARKER } from './constants'
|
import { LIST_ITEM_MARKER } from '../constants'
|
||||||
import {
|
import {
|
||||||
isArrayOfArrays,
|
isArrayOfArrays,
|
||||||
isArrayOfObjects,
|
isArrayOfObjects,
|
||||||
@@ -3,7 +3,7 @@ import type {
|
|||||||
JsonObject,
|
JsonObject,
|
||||||
JsonPrimitive,
|
JsonPrimitive,
|
||||||
JsonValue,
|
JsonValue,
|
||||||
} from './types'
|
} from '../types'
|
||||||
|
|
||||||
// #region Normalization (unknown → JsonValue)
|
// #region Normalization (unknown → JsonValue)
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { JsonPrimitive } from './types'
|
import type { JsonPrimitive } from '../types'
|
||||||
import {
|
import {
|
||||||
BACKSLASH,
|
BACKSLASH,
|
||||||
COMMA,
|
COMMA,
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
LIST_ITEM_MARKER,
|
LIST_ITEM_MARKER,
|
||||||
NULL_LITERAL,
|
NULL_LITERAL,
|
||||||
TRUE_LITERAL,
|
TRUE_LITERAL,
|
||||||
} from './constants'
|
} from '../constants'
|
||||||
|
|
||||||
// #region Primitive encoding
|
// #region Primitive encoding
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Depth } from './types'
|
import type { Depth } from '../types'
|
||||||
import { LIST_ITEM_PREFIX } from './constants'
|
import { LIST_ITEM_PREFIX } from '../constants'
|
||||||
|
|
||||||
export class LineWriter {
|
export class LineWriter {
|
||||||
private readonly lines: string[] = []
|
private readonly lines: string[] = []
|
||||||
@@ -8,8 +8,8 @@ import type {
|
|||||||
import { DEFAULT_DELIMITER } from './constants'
|
import { DEFAULT_DELIMITER } from './constants'
|
||||||
import { decodeValueFromLines } from './decode/decoders'
|
import { decodeValueFromLines } from './decode/decoders'
|
||||||
import { LineCursor, toParsedLines } from './decode/scanner'
|
import { LineCursor, toParsedLines } from './decode/scanner'
|
||||||
import { encodeValue } from './encoders'
|
import { encodeValue } from './encode/encoders'
|
||||||
import { normalizeValue } from './normalize'
|
import { normalizeValue } from './encode/normalize'
|
||||||
|
|
||||||
export { DEFAULT_DELIMITER, DELIMITERS } from './constants'
|
export { DEFAULT_DELIMITER, DELIMITERS } from './constants'
|
||||||
export type {
|
export type {
|
||||||
|
|||||||
Reference in New Issue
Block a user