Comparing version 2.1.1 to 2.1.2
@@ -57,3 +57,3 @@ import { Alias } from '../nodes/Alias.js'; | ||
} | ||
function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag }, onError) { | ||
function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) { | ||
const token = { | ||
@@ -73,4 +73,6 @@ type: 'scalar', | ||
node.spaceBefore = true; | ||
if (comment) | ||
if (comment) { | ||
node.comment = comment; | ||
node.range[2] = end; | ||
} | ||
return node; | ||
@@ -77,0 +79,0 @@ } |
@@ -29,3 +29,3 @@ import { Alias } from '../nodes/Alias.js'; | ||
value instanceof Boolean || | ||
(typeof BigInt === 'function' && value instanceof BigInt) // not supported everywhere | ||
(typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere | ||
) { | ||
@@ -32,0 +32,0 @@ // https://tc39.es/ecma262/#sec-serializejsonproperty |
@@ -14,3 +14,4 @@ import { isMap, isPair, isScalar } from '../../nodes/Node.js'; | ||
pair = key; | ||
else if (typeof key === 'object' && | ||
else if (key && | ||
typeof key === 'object' && | ||
'key' in key && | ||
@@ -17,0 +18,0 @@ 'value' in key && |
@@ -18,2 +18,3 @@ import type { Directives } from '../doc/directives.js'; | ||
tag: SourceToken | null; | ||
end: number; | ||
} | ||
@@ -26,3 +27,3 @@ declare const CN: { | ||
export declare function composeNode(ctx: ComposeContext, token: Token, props: Props, onError: ComposeErrorHandler): ParsedNode; | ||
export declare function composeEmptyNode(ctx: ComposeContext, offset: number, before: Token[] | undefined, pos: number | null, { spaceBefore, comment, anchor, tag }: Props, onError: ComposeErrorHandler): import("../index.js").Scalar.Parsed; | ||
export declare function composeEmptyNode(ctx: ComposeContext, offset: number, before: Token[] | undefined, pos: number | null, { spaceBefore, comment, anchor, tag, end }: Props, onError: ComposeErrorHandler): import("../index.js").Scalar.Parsed; | ||
export {}; |
@@ -59,3 +59,3 @@ 'use strict'; | ||
} | ||
function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag }, onError) { | ||
function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) { | ||
const token = { | ||
@@ -75,4 +75,6 @@ type: 'scalar', | ||
node.spaceBefore = true; | ||
if (comment) | ||
if (comment) { | ||
node.comment = comment; | ||
node.range[2] = end; | ||
} | ||
return node; | ||
@@ -79,0 +81,0 @@ } |
@@ -31,3 +31,3 @@ 'use strict'; | ||
value instanceof Boolean || | ||
(typeof BigInt === 'function' && value instanceof BigInt) // not supported everywhere | ||
(typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere | ||
) { | ||
@@ -34,0 +34,0 @@ // https://tc39.es/ecma262/#sec-serializejsonproperty |
import type { Pair } from './Pair.js'; | ||
import { ToJSContext } from './toJS.js'; | ||
export declare function addPairToJSMap(ctx: ToJSContext | undefined, map: Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>, { key, value }: Pair): Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>; | ||
import type { MapLike } from './YAMLMap.js'; | ||
export declare function addPairToJSMap(ctx: ToJSContext | undefined, map: MapLike, { key, value }: Pair): MapLike; |
@@ -26,4 +26,4 @@ import type { Document } from '../doc/Document.js'; | ||
resolve(doc: Document): Scalar | YAMLMap | YAMLSeq | undefined; | ||
toJSON(_arg?: unknown, ctx?: ToJSContext): unknown; | ||
toJSON(_arg?: unknown, ctx?: ToJSContext): {} | null; | ||
toString(ctx?: StringifyContext, _onComment?: () => void, _onChompKeep?: () => void): string; | ||
} |
@@ -9,2 +9,3 @@ import type { BlockMap, FlowCollection } from '../parse/cst.js'; | ||
import type { ToJSContext } from './toJS.js'; | ||
export declare type MapLike = Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>; | ||
export declare function findPair<K = unknown, V = unknown>(items: Iterable<Pair<K, V>>, key: unknown): Pair<K, V> | undefined; | ||
@@ -43,3 +44,3 @@ export declare namespace YAMLMap { | ||
*/ | ||
toJSON<T = unknown>(_?: unknown, ctx?: ToJSContext, Type?: { | ||
toJSON<T extends MapLike = Map<unknown, unknown>>(_?: unknown, ctx?: ToJSContext, Type?: { | ||
new (): T; | ||
@@ -46,0 +47,0 @@ }): any; |
@@ -16,3 +16,4 @@ 'use strict'; | ||
pair = key; | ||
else if (typeof key === 'object' && | ||
else if (key && | ||
typeof key === 'object' && | ||
'key' in key && | ||
@@ -19,0 +20,0 @@ 'value' in key && |
{ | ||
"name": "yaml", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"license": "ISC", | ||
@@ -75,7 +75,7 @@ "author": "Eemeli Aro <eemeli@gmail.com>", | ||
"@rollup/plugin-typescript": "^8.1.1", | ||
"@types/jest": "^27.0.1", | ||
"@types/jest": "^28.1.8", | ||
"@types/node": "^12.20.47", | ||
"@typescript-eslint/eslint-plugin": "^5.3.1", | ||
"@typescript-eslint/parser": "^5.3.1", | ||
"babel-jest": "^28.1.0", | ||
"babel-jest": "^29.0.1", | ||
"cross-env": "^7.0.3", | ||
@@ -85,3 +85,3 @@ "eslint": "^8.2.0", | ||
"fast-check": "^2.12.0", | ||
"jest": "^28.1.0", | ||
"jest": "^29.0.1", | ||
"jest-ts-webcompat-resolver": "^1.0.0", | ||
@@ -88,0 +88,0 @@ "prettier": "^2.2.1", |
# YAML <a href="https://www.npmjs.com/package/yaml"><img align="right" src="https://badge.fury.io/js/yaml.svg" title="npm package" /></a> | ||
`yaml` is a definitive library for [YAML](http://yaml.org/), the human friendly data serialization standard. | ||
`yaml` is a definitive library for [YAML](https://yaml.org/), the human friendly data serialization standard. | ||
This library: | ||
@@ -5,0 +5,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
648829
17333