mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Update checked-in dependencies
This commit is contained in:
29
node_modules/indent-string/index.js
generated
vendored
29
node_modules/indent-string/index.js
generated
vendored
@@ -1,11 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (string, count = 1, options) => {
|
||||
options = {
|
||||
indent: ' ',
|
||||
includeEmptyLines: false,
|
||||
...options
|
||||
};
|
||||
export default function indentString(string, count = 1, options = {}) {
|
||||
const {
|
||||
indent = ' ',
|
||||
includeEmptyLines = false
|
||||
} = options;
|
||||
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError(
|
||||
@@ -19,9 +16,15 @@ module.exports = (string, count = 1, options) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof options.indent !== 'string') {
|
||||
if (count < 0) {
|
||||
throw new RangeError(
|
||||
`Expected \`count\` to be at least 0, got \`${count}\``
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof indent !== 'string') {
|
||||
throw new TypeError(
|
||||
`Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\``
|
||||
`Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,7 +32,7 @@ module.exports = (string, count = 1, options) => {
|
||||
return string;
|
||||
}
|
||||
|
||||
const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
||||
const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
||||
|
||||
return string.replace(regex, options.indent.repeat(count));
|
||||
};
|
||||
return string.replace(regex, indent.repeat(count));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user