mirror of
https://github.com/github/codeql-action
synced 2026-12-04 13:59:31 +08:00
Fix dependabot issues
This commit is contained in:
1 parent
c89d9bd8b0
commit
531c6ba7c8
705 files changed
+53406
-20466
No files matched your search
+44
@@ -0,0 +1,44 @@
|
||||
declare namespace codeExcerpt {
|
||||
interface Options {
|
||||
/**
|
||||
* Number of surrounding lines to extract.
|
||||
*
|
||||
* @default 3
|
||||
*/
|
||||
readonly around?: number;
|
||||
}
|
||||
|
||||
interface ExcerptLine {
|
||||
/**
|
||||
* Line number
|
||||
*/
|
||||
readonly line: number;
|
||||
|
||||
/**
|
||||
* Line itself
|
||||
*/
|
||||
readonly value: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract code excerpts
|
||||
*/
|
||||
declare function codeExcerpt(
|
||||
/**
|
||||
* Source code
|
||||
*/
|
||||
source: string,
|
||||
|
||||
/**
|
||||
* Line number to extract excerpt for.
|
||||
*/
|
||||
line: number,
|
||||
|
||||
/**
|
||||
* Options
|
||||
*/
|
||||
options?: codeExcerpt.Options
|
||||
): codeExcerpt.ExcerptLine[] | undefined;
|
||||
|
||||
export = codeExcerpt;
|
||||
+5
-3
@@ -1,5 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
const tabsToSpaces = require('convert-to-spaces');
|
||||
|
||||
const generateLineNumbers = (line, around) => {
|
||||
@@ -27,10 +26,13 @@ module.exports = (source, line, options) => {
|
||||
source = tabsToSpaces(source).split(/\r?\n/);
|
||||
|
||||
if (line > source.length) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
options = Object.assign({around: 3}, options);
|
||||
options = {
|
||||
around: 3,
|
||||
...options
|
||||
};
|
||||
|
||||
return generateLineNumbers(line, options.around)
|
||||
.filter(line => source[line - 1] !== undefined)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) vdemedes <vdemedes@gmail.com> (github.com/vdemedes)
|
||||
Copyright (c) Vadim Demedes <vdemedes@gmail.com> (github.com/vadimdemedes)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+8
-9
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "code-excerpt",
|
||||
"version": "2.1.1",
|
||||
"version": "3.0.0",
|
||||
"description": "Extract code excerpts",
|
||||
"license": "MIT",
|
||||
"repository": "vadimdemedes/code-excerpt",
|
||||
@@ -10,22 +10,21 @@
|
||||
"url": "github.com/vadimdemedes"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
"test": "tsd && xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"dependencies": {
|
||||
"convert-to-spaces": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^0.16.0",
|
||||
"xo": "^0.17.1"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
"ava": "^3.9.0",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.32.0"
|
||||
}
|
||||
}
|
||||
+1
-9
@@ -1,15 +1,13 @@
|
||||
# code-excerpt [](https://travis-ci.org/vadimdemedes/code-excerpt)
|
||||
# code-excerpt 
|
||||
|
||||
> Extract code excerpts
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save code-excerpt
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
@@ -41,7 +39,6 @@ const excerpt = codeExcerpt(source, 5);
|
||||
// ]
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### codeExcerpt(source, line, [options])
|
||||
@@ -66,8 +63,3 @@ Type: `number`<br>
|
||||
Default: `3`
|
||||
|
||||
Number of surrounding lines to extract.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Vadim Demedes](https://github.com/vadimdemedes)
|
||||
Reference in new issue
Block a user