chore: add new lint rules

This commit is contained in:
Gusted 2024-10-23 08:10:18 +02:00
parent 1ec3e638a5
commit f63f02045e
No known key found for this signature in database
GPG key ID: FD821B732837125F
5 changed files with 8 additions and 5 deletions

View file

@ -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