id int64 0 3.78k | code stringlengths 13 37.9k | declarations stringlengths 16 64.6k |
|---|---|---|
100 | function resolveBlockSeq(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
bs: BlockSequence,
onError: ComposeErrorHandler
) {
const seq = new YAMLSeq(ctx.schema)
if (ctx.atRoot) ctx.atRoot = false
let offset = bs.offset
let commentEnd: number | null = null
for (const { start, val... | type ComposeNode = typeof CN |
101 | function resolveBlockSeq(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
bs: BlockSequence,
onError: ComposeErrorHandler
) {
const seq = new YAMLSeq(ctx.schema)
if (ctx.atRoot) ctx.atRoot = false
let offset = bs.offset
let commentEnd: number | null = null
for (const { start, val... | interface ComposeContext {
atRoot: boolean
directives: Directives
options: Readonly<Required<Omit<ParseOptions, 'lineCounter'>>>
schema: Readonly<Schema>
} |
102 | function resolveBlockSeq(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
bs: BlockSequence,
onError: ComposeErrorHandler
) {
const seq = new YAMLSeq(ctx.schema)
if (ctx.atRoot) ctx.atRoot = false
let offset = bs.offset
let commentEnd: number | null = null
for (const { start, val... | type ComposeErrorHandler = (
source: ErrorSource,
code: ErrorCode,
message: string,
warning?: boolean
) => void |
103 | function resolveBlockSeq(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
bs: BlockSequence,
onError: ComposeErrorHandler
) {
const seq = new YAMLSeq(ctx.schema)
if (ctx.atRoot) ctx.atRoot = false
let offset = bs.offset
let commentEnd: number | null = null
for (const { start, val... | interface BlockSequence {
type: 'block-seq'
offset: number
indent: number
items: Array<{
start: SourceToken[]
key?: never
sep?: never
value?: Token
}>
} |
104 | function resolveBlockMap(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
bm: BlockMap,
onError: ComposeErrorHandler
) {
const map = new YAMLMap<ParsedNode, ParsedNode>(ctx.schema)
if (ctx.atRoot) ctx.atRoot = false
let offset = bm.offset
let commentEnd: number | null = null
for ... | interface BlockMap {
type: 'block-map'
offset: number
indent: number
items: Array<
| { start: SourceToken[]; key?: never; sep?: never; value?: never }
| {
start: SourceToken[]
key: Token | null
sep: SourceToken[]
value?: Token
}
>
} |
105 | function resolveBlockMap(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
bm: BlockMap,
onError: ComposeErrorHandler
) {
const map = new YAMLMap<ParsedNode, ParsedNode>(ctx.schema)
if (ctx.atRoot) ctx.atRoot = false
let offset = bm.offset
let commentEnd: number | null = null
for ... | type ComposeNode = typeof CN |
106 | function resolveBlockMap(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
bm: BlockMap,
onError: ComposeErrorHandler
) {
const map = new YAMLMap<ParsedNode, ParsedNode>(ctx.schema)
if (ctx.atRoot) ctx.atRoot = false
let offset = bm.offset
let commentEnd: number | null = null
for ... | interface ComposeContext {
atRoot: boolean
directives: Directives
options: Readonly<Required<Omit<ParseOptions, 'lineCounter'>>>
schema: Readonly<Schema>
} |
107 | function resolveBlockMap(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
bm: BlockMap,
onError: ComposeErrorHandler
) {
const map = new YAMLMap<ParsedNode, ParsedNode>(ctx.schema)
if (ctx.atRoot) ctx.atRoot = false
let offset = bm.offset
let commentEnd: number | null = null
for ... | type ComposeErrorHandler = (
source: ErrorSource,
code: ErrorCode,
message: string,
warning?: boolean
) => void |
108 | function resolveFlowCollection(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
fc: FlowCollection,
onError: ComposeErrorHandler
) {
const isMap = fc.start.source === '{'
const fcName = isMap ? 'flow map' : 'flow sequence'
const coll = isMap
? (new YAMLMap(ctx.schema) as YAMLMap.P... | type ComposeNode = typeof CN |
109 | function resolveFlowCollection(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
fc: FlowCollection,
onError: ComposeErrorHandler
) {
const isMap = fc.start.source === '{'
const fcName = isMap ? 'flow map' : 'flow sequence'
const coll = isMap
? (new YAMLMap(ctx.schema) as YAMLMap.P... | interface ComposeContext {
atRoot: boolean
directives: Directives
options: Readonly<Required<Omit<ParseOptions, 'lineCounter'>>>
schema: Readonly<Schema>
} |
110 | function resolveFlowCollection(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
fc: FlowCollection,
onError: ComposeErrorHandler
) {
const isMap = fc.start.source === '{'
const fcName = isMap ? 'flow map' : 'flow sequence'
const coll = isMap
? (new YAMLMap(ctx.schema) as YAMLMap.P... | type ComposeErrorHandler = (
source: ErrorSource,
code: ErrorCode,
message: string,
warning?: boolean
) => void |
111 | function resolveFlowCollection(
{ composeNode, composeEmptyNode }: ComposeNode,
ctx: ComposeContext,
fc: FlowCollection,
onError: ComposeErrorHandler
) {
const isMap = fc.start.source === '{'
const fcName = isMap ? 'flow map' : 'flow sequence'
const coll = isMap
? (new YAMLMap(ctx.schema) as YAMLMap.P... | interface FlowCollection {
type: 'flow-collection'
offset: number
indent: number
start: SourceToken
items: CollectionItem[]
end: SourceToken[]
} |
112 | function resolveBlockScalar(
scalar: BlockScalar,
strict: boolean,
onError: ComposeErrorHandler
): {
value: string
type: Scalar.BLOCK_FOLDED | Scalar.BLOCK_LITERAL | null
comment: string
range: Range
} {
const start = scalar.offset
const header = parseBlockScalarHeader(scalar, strict, onError)
if (!... | interface BlockScalar {
type: 'block-scalar'
offset: number
indent: number
props: Token[]
source: string
} |
113 | function resolveBlockScalar(
scalar: BlockScalar,
strict: boolean,
onError: ComposeErrorHandler
): {
value: string
type: Scalar.BLOCK_FOLDED | Scalar.BLOCK_LITERAL | null
comment: string
range: Range
} {
const start = scalar.offset
const header = parseBlockScalarHeader(scalar, strict, onError)
if (!... | type ComposeErrorHandler = (
source: ErrorSource,
code: ErrorCode,
message: string,
warning?: boolean
) => void |
114 | function parseBlockScalarHeader(
{ offset, props }: BlockScalar,
strict: boolean,
onError: ComposeErrorHandler
) {
/* istanbul ignore if should not happen */
if (props[0].type !== 'block-scalar-header') {
onError(props[0], 'IMPOSSIBLE', 'Block scalar header not found')
return null
}
const { source... | interface BlockScalar {
type: 'block-scalar'
offset: number
indent: number
props: Token[]
source: string
} |
115 | function parseBlockScalarHeader(
{ offset, props }: BlockScalar,
strict: boolean,
onError: ComposeErrorHandler
) {
/* istanbul ignore if should not happen */
if (props[0].type !== 'block-scalar-header') {
onError(props[0], 'IMPOSSIBLE', 'Block scalar header not found')
return null
}
const { source... | type ComposeErrorHandler = (
source: ErrorSource,
code: ErrorCode,
message: string,
warning?: boolean
) => void |
116 | function applyReviver(
reviver: Reviver,
obj: unknown,
key: unknown,
val: any
) {
if (val && typeof val === 'object') {
if (Array.isArray(val)) {
for (let i = 0, len = val.length; i < len; ++i) {
const v0 = val[i]
const v1 = applyReviver(reviver, val, String(i), v0)
if (v1 ==... | type Reviver = (key: unknown, value: unknown) => unknown |
117 | function createNodeAnchors(doc: Document, prefix: string) {
const aliasObjects: unknown[] = []
const sourceObjects: CreateNodeContext['sourceObjects'] = new Map()
let prevAnchors: Set<string> | null = null
return {
onAnchor: (source: unknown) => {
aliasObjects.push(source)
if (!prevAnchors) pre... | interface Document {
type: 'document'
offset: number
start: SourceToken[]
value?: Token
end?: SourceToken[]
} |
118 | function createNodeAnchors(doc: Document, prefix: string) {
const aliasObjects: unknown[] = []
const sourceObjects: CreateNodeContext['sourceObjects'] = new Map()
let prevAnchors: Set<string> | null = null
return {
onAnchor: (source: unknown) => {
aliasObjects.push(source)
if (!prevAnchors) pre... | class Document<T extends Node = Node> {
declare readonly [NODE_TYPE]: symbol
/** A comment before this Document */
commentBefore: string | null = null
/** A comment immediately after this Document */
comment: string | null = null
/** The document contents. */
contents: T | null
directives?: Directiv... |
119 | createNode<T = unknown>(value: T, options?: CreateNodeOptions): NodeType<T> | type CreateNodeOptions = {
/**
* During node construction, use anchors and aliases to keep strictly equal
* non-null objects as equivalent in YAML.
*
* Default: `true`
*/
aliasDuplicateObjects?: boolean
/**
* Default prefix for anchors.
*
* Default: `'a'`, resulting in anchors `a1`, `a2`,... |
120 | createNode<T = unknown>(
value: T,
replacer: Replacer | CreateNodeOptions | null,
options?: CreateNodeOptions
): NodeType<T> | type CreateNodeOptions = {
/**
* During node construction, use anchors and aliases to keep strictly equal
* non-null objects as equivalent in YAML.
*
* Default: `true`
*/
aliasDuplicateObjects?: boolean
/**
* Default prefix for anchors.
*
* Default: `'a'`, resulting in anchors `a1`, `a2`,... |
121 | toString(options: ToStringOptions = {}): string {
if (this.errors.length > 0)
throw new Error('Document with errors cannot be stringified')
if (
'indent' in options &&
(!Number.isInteger(options.indent) || Number(options.indent) <= 0)
) {
const s = JSON.stringify(options.indent)
... | type ToStringOptions = {
/**
* Use block quote styles for scalar values where applicable.
* Set to `false` to disable block quotes completely.
*
* Default: `true`
*/
blockQuote?: boolean | 'folded' | 'literal'
/**
* Enforce `'block'` or `'flow'` style on maps and sequences.
* Empty collectio... |
122 | toString(doc?: Document) {
const lines = this.yaml.explicit
? [`%YAML ${this.yaml.version || '1.2'}`]
: []
const tagEntries = Object.entries(this.tags)
let tagNames: string[]
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
const tags: Record<string, boolean> = {}
vi... | interface Document {
type: 'document'
offset: number
start: SourceToken[]
value?: Token
end?: SourceToken[]
} |
123 | toString(doc?: Document) {
const lines = this.yaml.explicit
? [`%YAML ${this.yaml.version || '1.2'}`]
: []
const tagEntries = Object.entries(this.tags)
let tagNames: string[]
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
const tags: Record<string, boolean> = {}
vi... | class Document<T extends Node = Node> {
declare readonly [NODE_TYPE]: symbol
/** A comment before this Document */
commentBefore: string | null = null
/** A comment immediately after this Document */
comment: string | null = null
/** The document contents. */
contents: T | null
directives?: Directiv... |
124 | function stringifyNumber({
format,
minFractionDigits,
tag,
value
}: Scalar) {
if (typeof value === 'bigint') return String(value)
const num = typeof value === 'number' ? value : Number(value)
if (!isFinite(num)) return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf'
let n = JSON.stringify(value)
if (... | class Scalar<T = unknown> extends NodeBase {
static readonly BLOCK_FOLDED = 'BLOCK_FOLDED'
static readonly BLOCK_LITERAL = 'BLOCK_LITERAL'
static readonly PLAIN = 'PLAIN'
static readonly QUOTE_DOUBLE = 'QUOTE_DOUBLE'
static readonly QUOTE_SINGLE = 'QUOTE_SINGLE'
value: T
/** An optional anchor on this n... |
125 | function addCommentBefore(
{ indent, options: { commentString } }: StringifyContext,
lines: string[],
comment: string | null | undefined,
chompKeep: boolean
) {
if (comment && chompKeep) comment = comment.replace(/^\n+/, '')
if (comment) {
const ic = indentComment(commentString(comment), indent)
lin... | type StringifyContext = {
actualString?: boolean
allNullValues?: boolean
anchors: Set<string>
doc: Document
forceBlockIndent?: boolean
implicitKey?: boolean
indent: string
indentStep: string
indentAtStart?: number
inFlow: boolean | null
inStringifyKey?: boolean
flowCollectionPadding: string
op... |
126 | function createStringifyContext(
doc: Document,
options: ToStringOptions
): StringifyContext {
const opt = Object.assign(
{
blockQuote: true,
commentString: stringifyComment,
defaultKeyType: null,
defaultStringType: 'PLAIN',
directives: null,
doubleQuotedAsJSON: false,
... | interface Document {
type: 'document'
offset: number
start: SourceToken[]
value?: Token
end?: SourceToken[]
} |
127 | function createStringifyContext(
doc: Document,
options: ToStringOptions
): StringifyContext {
const opt = Object.assign(
{
blockQuote: true,
commentString: stringifyComment,
defaultKeyType: null,
defaultStringType: 'PLAIN',
directives: null,
doubleQuotedAsJSON: false,
... | class Document<T extends Node = Node> {
declare readonly [NODE_TYPE]: symbol
/** A comment before this Document */
commentBefore: string | null = null
/** A comment immediately after this Document */
comment: string | null = null
/** The document contents. */
contents: T | null
directives?: Directiv... |
128 | function createStringifyContext(
doc: Document,
options: ToStringOptions
): StringifyContext {
const opt = Object.assign(
{
blockQuote: true,
commentString: stringifyComment,
defaultKeyType: null,
defaultStringType: 'PLAIN',
directives: null,
doubleQuotedAsJSON: false,
... | type ToStringOptions = {
/**
* Use block quote styles for scalar values where applicable.
* Set to `false` to disable block quotes completely.
*
* Default: `true`
*/
blockQuote?: boolean | 'folded' | 'literal'
/**
* Enforce `'block'` or `'flow'` style on maps and sequences.
* Empty collectio... |
129 | function stringifyProps(
node: Node,
tagObj: ScalarTag | CollectionTag,
{ anchors, doc }: StringifyContext
) {
if (!doc.directives) return ''
const props = []
const anchor = (isScalar(node) || isCollection(node)) && node.anchor
if (anchor && anchorIsValid(anchor)) {
anchors.add(anchor)
props.push(... | type StringifyContext = {
actualString?: boolean
allNullValues?: boolean
anchors: Set<string>
doc: Document
forceBlockIndent?: boolean
implicitKey?: boolean
indent: string
indentStep: string
indentAtStart?: number
inFlow: boolean | null
inStringifyKey?: boolean
flowCollectionPadding: string
op... |
130 | function stringifyProps(
node: Node,
tagObj: ScalarTag | CollectionTag,
{ anchors, doc }: StringifyContext
) {
if (!doc.directives) return ''
const props = []
const anchor = (isScalar(node) || isCollection(node)) && node.anchor
if (anchor && anchorIsValid(anchor)) {
anchors.add(anchor)
props.push(... | type Node<T = unknown> =
| Alias
| Scalar<T>
| YAMLMap<unknown, T>
| YAMLSeq<T> |
131 | (ctx: StringifyContext): FoldOptions => ({
indentAtStart: ctx.indentAtStart,
lineWidth: ctx.options.lineWidth,
minContentWidth: ctx.options.minContentWidth
}) | type StringifyContext = {
actualString?: boolean
allNullValues?: boolean
anchors: Set<string>
doc: Document
forceBlockIndent?: boolean
implicitKey?: boolean
indent: string
indentStep: string
indentAtStart?: number
inFlow: boolean | null
inStringifyKey?: boolean
flowCollectionPadding: string
op... |
132 | function blockString(
{ comment, type, value }: StringifyScalar,
ctx: StringifyContext,
onComment?: () => void,
onChompKeep?: () => void
) {
const { blockQuote, commentString, lineWidth } = ctx.options
// 1. Block can't end in whitespace unless the last line is non-empty.
// 2. Strings consisting of only ... | type StringifyContext = {
actualString?: boolean
allNullValues?: boolean
anchors: Set<string>
doc: Document
forceBlockIndent?: boolean
implicitKey?: boolean
indent: string
indentStep: string
indentAtStart?: number
inFlow: boolean | null
inStringifyKey?: boolean
flowCollectionPadding: string
op... |
133 | function blockString(
{ comment, type, value }: StringifyScalar,
ctx: StringifyContext,
onComment?: () => void,
onChompKeep?: () => void
) {
const { blockQuote, commentString, lineWidth } = ctx.options
// 1. Block can't end in whitespace unless the last line is non-empty.
// 2. Strings consisting of only ... | interface StringifyScalar {
value: string
comment?: string | null
type?: string
} |
134 | function plainString(
item: StringifyScalar,
ctx: StringifyContext,
onComment?: () => void,
onChompKeep?: () => void
) {
const { type, value } = item
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx
if (
(implicitKey && /[\n[\]{},]/.test(value)) ||
(inFlow && /[[\]{},]/.test(v... | type StringifyContext = {
actualString?: boolean
allNullValues?: boolean
anchors: Set<string>
doc: Document
forceBlockIndent?: boolean
implicitKey?: boolean
indent: string
indentStep: string
indentAtStart?: number
inFlow: boolean | null
inStringifyKey?: boolean
flowCollectionPadding: string
op... |
135 | function plainString(
item: StringifyScalar,
ctx: StringifyContext,
onComment?: () => void,
onChompKeep?: () => void
) {
const { type, value } = item
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx
if (
(implicitKey && /[\n[\]{},]/.test(value)) ||
(inFlow && /[[\]{},]/.test(v... | interface StringifyScalar {
value: string
comment?: string | null
type?: string
} |
136 | function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protoco... | interface URIComponents {
scheme?:string;
userinfo?:string;
host?:string;
port?:number|string;
path?:string;
query?:string;
fragment?:string;
reference?:string;
error?:string;
} |
137 | function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protoco... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
138 | function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protoco... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
139 | function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protoco... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
140 | function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protoco... | interface URIRegExps {
NOT_SCHEME : RegExp,
NOT_USERINFO : RegExp,
NOT_HOST : RegExp,
NOT_PATH : RegExp,
NOT_PATH_NOSCHEME : RegExp,
NOT_QUERY : RegExp,
NOT_FRAGMENT : RegExp,
ESCAPE : RegExp,
UNRESERVED : RegExp,
OTHER_CHARS : RegExp,
PCT_ENCODED : RegExp,
IPV4ADDRESS : RegExp,
IPV6ADDRESS : RegExp,
} |
141 | function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protoco... | interface URIRegExps {
NOT_SCHEME: RegExp;
NOT_USERINFO: RegExp;
NOT_HOST: RegExp;
NOT_PATH: RegExp;
NOT_PATH_NOSCHEME: RegExp;
NOT_QUERY: RegExp;
NOT_FRAGMENT: RegExp;
ESCAPE: RegExp;
UNRESERVED: RegExp;
OTHER_CHARS: RegExp;
PCT_ENCODED: RegExp;
IPV4ADDRESS: RegExp;
... |
142 | function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protoco... | interface URIRegExps {
NOT_SCHEME: RegExp;
NOT_USERINFO: RegExp;
NOT_HOST: RegExp;
NOT_PATH: RegExp;
NOT_PATH_NOSCHEME: RegExp;
NOT_QUERY: RegExp;
NOT_FRAGMENT: RegExp;
ESCAPE: RegExp;
UNRESERVED: RegExp;
OTHER_CHARS: RegExp;
PCT_ENCODED: RegExp;
IPV4ADDRESS: RegExp;
... |
143 | function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protoco... | interface URIRegExps {
NOT_SCHEME: RegExp;
NOT_USERINFO: RegExp;
NOT_HOST: RegExp;
NOT_PATH: RegExp;
NOT_PATH_NOSCHEME: RegExp;
NOT_QUERY: RegExp;
NOT_FRAGMENT: RegExp;
ESCAPE: RegExp;
UNRESERVED: RegExp;
OTHER_CHARS: RegExp;
PCT_ENCODED: RegExp;
IPV4ADDRESS: RegExp;
... |
144 | function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (co... | interface URIComponents {
scheme?:string;
userinfo?:string;
host?:string;
port?:number|string;
path?:string;
query?:string;
fragment?:string;
reference?:string;
error?:string;
} |
145 | function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (co... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
146 | function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (co... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
147 | function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (co... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
148 | function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (co... | interface URIOptions {
scheme?:string;
reference?:string;
tolerant?:boolean;
absolutePath?:boolean;
iri?:boolean;
unicodeSupport?:boolean;
domainHost?:boolean;
} |
149 | function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (co... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
150 | function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (co... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
151 | function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (co... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
152 | function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specifi... | interface URIComponents {
scheme?:string;
userinfo?:string;
host?:string;
port?:number|string;
path?:string;
query?:string;
fragment?:string;
reference?:string;
error?:string;
} |
153 | function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specifi... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
154 | function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specifi... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
155 | function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specifi... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
156 | function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specifi... | interface URIOptions {
scheme?:string;
reference?:string;
tolerant?:boolean;
absolutePath?:boolean;
iri?:boolean;
unicodeSupport?:boolean;
domainHost?:boolean;
} |
157 | function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specifi... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
158 | function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specifi... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
159 | function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specifi... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
160 | function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative,... | interface URIComponents {
scheme?:string;
userinfo?:string;
host?:string;
port?:number|string;
path?:string;
query?:string;
fragment?:string;
reference?:string;
error?:string;
} |
161 | function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative,... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
162 | function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative,... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
163 | function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative,... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
164 | function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative,... | interface URIOptions {
scheme?:string;
reference?:string;
tolerant?:boolean;
absolutePath?:boolean;
iri?:boolean;
unicodeSupport?:boolean;
domainHost?:boolean;
} |
165 | function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative,... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
166 | function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative,... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
167 | function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative,... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
168 | function normalize(uri:URIComponents, options?:URIOptions):URIComponents; | interface URIComponents {
scheme?:string;
userinfo?:string;
host?:string;
port?:number|string;
path?:string;
query?:string;
fragment?:string;
reference?:string;
error?:string;
} |
169 | function normalize(uri:URIComponents, options?:URIOptions):URIComponents; | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
170 | function normalize(uri:URIComponents, options?:URIOptions):URIComponents; | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
171 | function normalize(uri:URIComponents, options?:URIOptions):URIComponents; | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
172 | function normalize(uri:URIComponents, options?:URIOptions):URIComponents; | interface URIOptions {
scheme?:string;
reference?:string;
tolerant?:boolean;
absolutePath?:boolean;
iri?:boolean;
unicodeSupport?:boolean;
domainHost?:boolean;
} |
173 | function normalize(uri:URIComponents, options?:URIOptions):URIComponents; | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
174 | function normalize(uri:URIComponents, options?:URIOptions):URIComponents; | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
175 | function normalize(uri:URIComponents, options?:URIOptions):URIComponents; | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
176 | function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean; | interface URIComponents {
scheme?:string;
userinfo?:string;
host?:string;
port?:number|string;
path?:string;
query?:string;
fragment?:string;
reference?:string;
error?:string;
} |
177 | function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean; | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
178 | function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean; | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
179 | function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean; | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
180 | function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean; | interface URIOptions {
scheme?:string;
reference?:string;
tolerant?:boolean;
absolutePath?:boolean;
iri?:boolean;
unicodeSupport?:boolean;
domainHost?:boolean;
} |
181 | function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean; | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
182 | function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean; | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
183 | function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean; | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
184 | function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
const uuidComponents = urnComponents as UUIDComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.... | interface URIOptions {
scheme?:string;
reference?:string;
tolerant?:boolean;
absolutePath?:boolean;
iri?:boolean;
unicodeSupport?:boolean;
domainHost?:boolean;
} |
185 | function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
const uuidComponents = urnComponents as UUIDComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
186 | function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
const uuidComponents = urnComponents as UUIDComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
187 | function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
const uuidComponents = urnComponents as UUIDComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.... | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
188 | function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
const uuidComponents = urnComponents as UUIDComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.... | interface URNComponents extends URIComponents {
nid?:string;
nss?:string;
} |
189 | function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
const uuidComponents = urnComponents as UUIDComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.... | interface URNComponents extends URIComponents {
nid?: string;
nss?: string;
} |
190 | function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
const urnComponents = uuidComponents as URNComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
} | interface URIOptions {
scheme?:string;
reference?:string;
tolerant?:boolean;
absolutePath?:boolean;
iri?:boolean;
unicodeSupport?:boolean;
domainHost?:boolean;
} |
191 | function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
const urnComponents = uuidComponents as URNComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
} | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
192 | function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
const urnComponents = uuidComponents as URNComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
} | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
193 | function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
const urnComponents = uuidComponents as URNComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
} | interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
} |
194 | function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
const urnComponents = uuidComponents as URNComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
} | interface UUIDComponents extends URNComponents {
uuid?: string;
} |
195 | function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
const urnComponents = uuidComponents as URNComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
} | interface UUIDComponents extends URNComponents {
uuid?: string;
} |
196 | function (components:URIComponents, options:URNOptions):URNComponents {
const matches = components.path && components.path.match(URN_PARSE);
let urnComponents = components as URNComponents;
if (matches) {
const scheme = options.scheme || urnComponents.scheme || "urn";
const nid = matches[1].toLowerCase();
... | interface URIComponents {
scheme?:string;
userinfo?:string;
host?:string;
port?:number|string;
path?:string;
query?:string;
fragment?:string;
reference?:string;
error?:string;
} |
197 | function (components:URIComponents, options:URNOptions):URNComponents {
const matches = components.path && components.path.match(URN_PARSE);
let urnComponents = components as URNComponents;
if (matches) {
const scheme = options.scheme || urnComponents.scheme || "urn";
const nid = matches[1].toLowerCase();
... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
198 | function (components:URIComponents, options:URNOptions):URNComponents {
const matches = components.path && components.path.match(URN_PARSE);
let urnComponents = components as URNComponents;
if (matches) {
const scheme = options.scheme || urnComponents.scheme || "urn";
const nid = matches[1].toLowerCase();
... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
199 | function (components:URIComponents, options:URNOptions):URNComponents {
const matches = components.path && components.path.match(URN_PARSE);
let urnComponents = components as URNComponents;
if (matches) {
const scheme = options.scheme || urnComponents.scheme || "urn";
const nid = matches[1].toLowerCase();
... | interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.