This commit is contained in:
counterweight 2026-05-14 10:56:04 +02:00
parent bc92231240
commit b8225c639e
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
11904 changed files with 1472749 additions and 133 deletions

35
node_modules/@marp-team/marpit/lib/helpers/split.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.split = split;
/** @module */
/**
* Split array into multiple arrays by specified condition.
*
* @param {Array} arr Target array.
* @param {splitCallback} func Callback to split array.
* @param {boolean} [keepSplitValue=false] Keep split value. The split
* point is before the matched value.
* @returns {Array[]} Split array.
*/
function split(arr, func, keepSplitValue = false) {
const ret = [[]];
for (const value of arr) {
/**
* Return true at the split point.
*
* @callback splitCallback
* @param {*} value
*/
if (func(value)) {
ret.push(keepSplitValue ? [value] : []);
} else {
ret[ret.length - 1].push(value);
}
}
return ret;
}
var _default = exports.default = split;