mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-04 13:50:39 +00:00
chore: add new lint rules
This commit is contained in:
parent
1ec3e638a5
commit
f63f02045e
5 changed files with 8 additions and 5 deletions
|
@ -3,13 +3,13 @@ import {encode, decode} from 'uint8-to-base64';
|
|||
// transform /path/to/file.ext to file.ext
|
||||
export function basename(path = '') {
|
||||
const lastSlashIndex = path.lastIndexOf('/');
|
||||
return lastSlashIndex < 0 ? path : path.substring(lastSlashIndex + 1);
|
||||
return lastSlashIndex === -1 ? path : path.substring(lastSlashIndex + 1);
|
||||
}
|
||||
|
||||
// transform /path/to/file.ext to .ext
|
||||
export function extname(path = '') {
|
||||
const lastPointIndex = path.lastIndexOf('.');
|
||||
return lastPointIndex < 0 ? '' : path.substring(lastPointIndex);
|
||||
return lastPointIndex === -1 ? '' : path.substring(lastPointIndex);
|
||||
}
|
||||
|
||||
// test whether a variable is an object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue