1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2024-11-23 09:17:19 +00:00
action-ansible-playbook/node_modules/yaml/dist/nodes/YAMLMap.d.ts

54 lines
2.4 KiB
TypeScript
Raw Normal View History

2022-10-21 14:44:44 +00:00
import type { BlockMap, FlowCollection } from '../parse/cst.js';
import type { Schema } from '../schema/Schema.js';
import type { StringifyContext } from '../stringify/stringify.js';
2024-01-17 09:08:10 +00:00
import { CreateNodeContext } from '../util.js';
2022-10-21 14:44:44 +00:00
import { Collection } from './Collection.js';
2024-01-17 09:08:10 +00:00
import type { ParsedNode, Range } from './Node.js';
2022-10-21 14:44:44 +00:00
import { Pair } from './Pair.js';
import { Scalar } from './Scalar.js';
import type { ToJSContext } from './toJS.js';
2024-01-17 09:08:10 +00:00
export type MapLike = Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>;
2022-10-21 14:44:44 +00:00
export declare function findPair<K = unknown, V = unknown>(items: Iterable<Pair<K, V>>, key: unknown): Pair<K, V> | undefined;
export declare namespace YAMLMap {
interface Parsed<K extends ParsedNode = ParsedNode, V extends ParsedNode | null = ParsedNode | null> extends YAMLMap<K, V> {
items: Pair<K, V>[];
range: Range;
srcToken?: BlockMap | FlowCollection;
}
}
export declare class YAMLMap<K = unknown, V = unknown> extends Collection {
static get tagName(): 'tag:yaml.org,2002:map';
items: Pair<K, V>[];
constructor(schema?: Schema);
2024-01-17 09:08:10 +00:00
/**
* A generic collection parsing method that can be extended
* to other node classes that inherit from YAMLMap
*/
static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLMap<unknown, unknown>;
2022-10-21 14:44:44 +00:00
/**
* Adds a value to the collection.
*
* @param overwrite - If not set `true`, using a key that is already in the
* collection will throw. Otherwise, overwrites the previous value.
*/
add(pair: Pair<K, V> | {
key: K;
value: V;
}, overwrite?: boolean): void;
delete(key: unknown): boolean;
get(key: unknown, keepScalar: true): Scalar<V> | undefined;
get(key: unknown, keepScalar?: false): V | undefined;
get(key: unknown, keepScalar?: boolean): V | Scalar<V> | undefined;
has(key: unknown): boolean;
set(key: K, value: V): void;
/**
* @param ctx - Conversion context, originally set in Document#toJS()
* @param {Class} Type - If set, forces the returned collection type
* @returns Instance of Type, Map, or Object
*/
toJSON<T extends MapLike = Map<unknown, unknown>>(_?: unknown, ctx?: ToJSContext, Type?: {
new (): T;
}): any;
toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
}