Skip to content

Commit

Permalink
chore: migrate to rattail
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchouji committed Nov 10, 2024
1 parent 2269ace commit be6ce76
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,8 @@
"typescript": "^5.6.3",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"rattail": "^1.0.0"
}
}
17 changes: 17 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/aliases.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs';
import { exec } from 'node:child_process';
import { isEmpty, isArray } from './utils';
import { isEmpty, isArray } from 'rattail';
import { Alias } from './types';
import storePath from './path';

Expand Down
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
NEED_CHECK_THE_FORMAT,
SYSTEM_ALIAS,
} from './constants';
import { getAliasName, isEmpty, isNonEmptyArray } from './utils';
import { isEmpty, isNonEmptyArray } from 'rattail';
import { getAliasName } from './utils';
import { Alias } from './types';
import storePath from './path';

Expand Down
12 changes: 0 additions & 12 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
export function isArray(val: unknown): val is Array<any> {
return Array.isArray(val);
}

export function isNonEmptyArray(val: unknown): val is Array<any> {
return isArray(val) && !!val.length;
}

export function isEmpty(val: unknown) {
return val === undefined || val === null || val === '' || (isArray(val) && !val.length);
}

export function getAliasName(alias: string) {
if (!alias.includes('=')) {
return undefined;
Expand Down

0 comments on commit be6ce76

Please sign in to comment.