🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
30
node_modules/hast-util-to-html/lib/omission/omission.js
generated
vendored
Normal file
30
node_modules/hast-util-to-html/lib/omission/omission.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* @typedef {import('../types.js').OmitHandle} OmitHandle
|
||||
*/
|
||||
|
||||
const own = {}.hasOwnProperty
|
||||
|
||||
/**
|
||||
* Factory to check if a given node can have a tag omitted.
|
||||
*
|
||||
* @param {Record<string, OmitHandle>} handlers
|
||||
* Omission handlers, where each key is a tag name, and each value is the
|
||||
* corresponding handler.
|
||||
* @returns {OmitHandle}
|
||||
* Whether to omit a tag of an element.
|
||||
*/
|
||||
export function omission(handlers) {
|
||||
return omit
|
||||
|
||||
/**
|
||||
* Check if a given node can have a tag omitted.
|
||||
*
|
||||
* @type {OmitHandle}
|
||||
*/
|
||||
function omit(node, index, parent) {
|
||||
return (
|
||||
own.call(handlers, node.tagName) &&
|
||||
handlers[node.tagName](node, index, parent)
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue