🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
11
node_modules/hast-util-to-html/lib/omission/util/comment.d.ts
generated
vendored
Normal file
11
node_modules/hast-util-to-html/lib/omission/util/comment.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @typedef {import('../../types.js').Node} Node
|
||||
* @typedef {import('../../types.js').Comment} Comment
|
||||
*/
|
||||
/**
|
||||
* @param {Node} node
|
||||
* @returns {node is Comment}
|
||||
*/
|
||||
export function comment(node: Node): node is import('hast').Comment
|
||||
export type Node = import('../../types.js').Node
|
||||
export type Comment = import('../../types.js').Comment
|
28
node_modules/hast-util-to-html/lib/omission/util/siblings.d.ts
generated
vendored
Normal file
28
node_modules/hast-util-to-html/lib/omission/util/siblings.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Find applicable siblings in a direction.
|
||||
*
|
||||
* @param {Parent | null | undefined} parent
|
||||
* @param {number | null | undefined} index
|
||||
* @param {boolean | null | undefined} [includeWhitespace=false]
|
||||
* @returns {Content}
|
||||
*/
|
||||
export function siblingAfter(
|
||||
parent: Parent | null | undefined,
|
||||
index: number | null | undefined,
|
||||
includeWhitespace?: boolean | null | undefined
|
||||
): Content
|
||||
/**
|
||||
* Find applicable siblings in a direction.
|
||||
*
|
||||
* @param {Parent | null | undefined} parent
|
||||
* @param {number | null | undefined} index
|
||||
* @param {boolean | null | undefined} [includeWhitespace=false]
|
||||
* @returns {Content}
|
||||
*/
|
||||
export function siblingBefore(
|
||||
parent: Parent | null | undefined,
|
||||
index: number | null | undefined,
|
||||
includeWhitespace?: boolean | null | undefined
|
||||
): Content
|
||||
export type Parent = import('../../types.js').Parent
|
||||
export type Content = import('../../types.js').Content
|
41
node_modules/hast-util-to-html/lib/omission/util/siblings.js
generated
vendored
Normal file
41
node_modules/hast-util-to-html/lib/omission/util/siblings.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* @typedef {import('../../types.js').Parent} Parent
|
||||
* @typedef {import('../../types.js').Content} Content
|
||||
*/
|
||||
|
||||
import {whitespace} from 'hast-util-whitespace'
|
||||
|
||||
export const siblingAfter = siblings(1)
|
||||
export const siblingBefore = siblings(-1)
|
||||
|
||||
/**
|
||||
* Factory to check siblings in a direction.
|
||||
*
|
||||
* @param {number} increment
|
||||
*/
|
||||
function siblings(increment) {
|
||||
return sibling
|
||||
|
||||
/**
|
||||
* Find applicable siblings in a direction.
|
||||
*
|
||||
* @param {Parent | null | undefined} parent
|
||||
* @param {number | null | undefined} index
|
||||
* @param {boolean | null | undefined} [includeWhitespace=false]
|
||||
* @returns {Content}
|
||||
*/
|
||||
function sibling(parent, index, includeWhitespace) {
|
||||
const siblings = parent ? parent.children : []
|
||||
let offset = (index || 0) + increment
|
||||
let next = siblings && siblings[offset]
|
||||
|
||||
if (!includeWhitespace) {
|
||||
while (next && whitespace(next)) {
|
||||
offset += increment
|
||||
next = siblings[offset]
|
||||
}
|
||||
}
|
||||
|
||||
return next
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue