Skip to content

Commit

Permalink
chore: slice(0) -> slice()
Browse files Browse the repository at this point in the history
  • Loading branch information
hegemonic committed Jan 9, 2023
1 parent 8c6aad8 commit 9b07314
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/jsdoc-parse/lib/ast-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ const getParamNames = (exports.getParamNames = (node) => {
return [];
}

params = node.params.slice(0);
params = node.params.slice();

return params.map((param) => nodeToValue(param));
});
Expand Down
2 changes: 1 addition & 1 deletion packages/jsdoc-task-runner/lib/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = class Task extends Emittery {
if (typeof opts.dependsOn === 'string') {
deps = [opts.dependsOn];
} else if (Array.isArray(opts.dependsOn)) {
deps = opts.dependsOn.slice(0);
deps = opts.dependsOn.slice();
}

this.name = opts.name || null;
Expand Down
2 changes: 1 addition & 1 deletion packages/jsdoc/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ module.exports = (() => {
const options = dependencies.get('options');
let packageJson;
let sourceFile;
let sourceFiles = options._ ? options._.slice(0) : [];
let sourceFiles = options._ ? options._.slice() : [];

if (conf.source && conf.source.include) {
sourceFiles = sourceFiles.concat(config.source.include);
Expand Down
4 changes: 2 additions & 2 deletions packages/jsdoc/lib/jsdoc/doclet.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ class Doclet {
* The positions of the first and last characters of the code associated with this doclet.
* @type Array.<number>
*/
this.meta.range = meta.range.slice(0);
this.meta.range = meta.range.slice();
}

if (meta.lineno) {
Expand Down Expand Up @@ -652,7 +652,7 @@ class Doclet {
this.meta.code.value = meta.code.value;
}
if (meta.code.paramnames) {
this.meta.code.paramnames = meta.code.paramnames.slice(0);
this.meta.code.paramnames = meta.code.paramnames.slice();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jsdoc/lib/jsdoc/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const stripBom = require('strip-bom');

// Collect all of the license information from a `package.json` file.
function getLicenses(packageInfo) {
const licenses = packageInfo.licenses ? packageInfo.licenses.slice(0) : [];
const licenses = packageInfo.licenses ? packageInfo.licenses.slice() : [];

if (packageInfo.license) {
licenses.push({ type: packageInfo.license });
Expand Down
2 changes: 1 addition & 1 deletion packages/jsdoc/lib/jsdoc/src/visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ class Visitor {
let rawComment;

function addComments(source) {
comments = comments.concat(source.slice(0));
comments = comments.concat(source.slice());
}

if (!hasComments(node) && (!node.type || !isBlock)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsdoc/lib/jsdoc/src/walker.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function moveTrailingComments(source, target, count) {
source.trailingComments.length - count,
count
);
source.trailingComments = source.trailingComments.slice(0);
source.trailingComments = source.trailingComments.slice();
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function cloneTagDef(tagDef, extras) {
}

function getSourcePaths(env) {
const sourcePaths = env.sourceFiles.slice(0) || [];
const sourcePaths = env.sourceFiles.slice() || [];

if (env.opts._) {
env.opts._.forEach((sourcePath) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsdoc/test/specs/jsdoc/src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ describe('jsdoc/src/parser', () => {
attachTo(parser);
parser.parse(source);
events.all
.slice(0)
.slice()
.sort(sourceOrderSort)
.forEach((e, i) => {
expect(e).toBe(events.all[i]);
Expand Down
4 changes: 2 additions & 2 deletions packages/jsdoc/test/specs/tags/overviewtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe('@overview tag', () => {
const env = jsdoc.deps.get('env');

let srcParser;
const sourceFiles = env.sourceFiles.slice(0);
const sourcePaths = env.opts._.slice(0);
const sourceFiles = env.sourceFiles.slice();
const sourcePaths = env.opts._.slice();

beforeEach(() => {
env.opts._ = [path.normalize(`${__dirname}/../../fixtures`)];
Expand Down

0 comments on commit 9b07314

Please sign in to comment.