🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
34
node_modules/micromark-util-resolve-all/index.js
generated
vendored
Normal file
34
node_modules/micromark-util-resolve-all/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* @typedef {import('micromark-util-types').Event} Event
|
||||
* @typedef {import('micromark-util-types').Resolver} Resolver
|
||||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
|
||||
*/
|
||||
|
||||
/**
|
||||
* Call all `resolveAll`s.
|
||||
*
|
||||
* @param {Array<{resolveAll?: Resolver | undefined}>} constructs
|
||||
* List of constructs, optionally with `resolveAll`s.
|
||||
* @param {Array<Event>} events
|
||||
* List of events.
|
||||
* @param {TokenizeContext} context
|
||||
* Context used by `tokenize`.
|
||||
* @returns {Array<Event>}
|
||||
* Changed events.
|
||||
*/
|
||||
export function resolveAll(constructs, events, context) {
|
||||
/** @type {Array<Resolver>} */
|
||||
const called = []
|
||||
let index = -1
|
||||
|
||||
while (++index < constructs.length) {
|
||||
const resolve = constructs[index].resolveAll
|
||||
|
||||
if (resolve && !called.includes(resolve)) {
|
||||
events = resolve(events, context)
|
||||
called.push(resolve)
|
||||
}
|
||||
}
|
||||
|
||||
return events
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue