Files
dealplustech/node_modules/mdast-util-to-markdown/lib/configure.js
Kunthawat 77ac4d2d05 feat: Upgrade to Astro with full PDPA compliance
PDPA Features:
 Cookie consent banner
 Consent logging API
 Admin dashboard
 Privacy Policy
 Terms & Conditions

Technical:
 Astro 5.x + Tailwind v4
 Docker on port 80
 SQLite database
 15 pages built

Ready for Easypanel deployment.
2026-03-12 10:01:04 +07:00

80 lines
1.4 KiB
JavaScript

/**
* @import {Options, State} from './types.js'
*/
const own = {}.hasOwnProperty
/**
* @param {State} base
* @param {Options} extension
* @returns {State}
*/
export function configure(base, extension) {
let index = -1
/** @type {keyof Options} */
let key
// First do subextensions.
if (extension.extensions) {
while (++index < extension.extensions.length) {
configure(base, extension.extensions[index])
}
}
for (key in extension) {
if (own.call(extension, key)) {
switch (key) {
case 'extensions': {
// Empty.
break
}
/* c8 ignore next 4 */
case 'unsafe': {
list(base[key], extension[key])
break
}
case 'join': {
list(base[key], extension[key])
break
}
case 'handlers': {
map(base[key], extension[key])
break
}
default: {
// @ts-expect-error: matches.
base.options[key] = extension[key]
}
}
}
}
return base
}
/**
* @template T
* @param {Array<T>} left
* @param {Array<T> | null | undefined} right
*/
function list(left, right) {
if (right) {
left.push(...right)
}
}
/**
* @template T
* @param {Record<string, T>} left
* @param {Record<string, T> | null | undefined} right
*/
function map(left, right) {
if (right) {
Object.assign(left, right)
}
}