chore(utils): blank character detection
This commit is contained in:
parent
a97396ef01
commit
e30777f0e3
2 changed files with 75 additions and 0 deletions
16
src/lib/utils/blank.ts
Normal file
16
src/lib/utils/blank.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import type { Character } from '../types';
|
||||
|
||||
const DEFAULT_LANGUAGES = ['Tau Ceti Basic'];
|
||||
|
||||
export function isBlankCharacter(char: Character): boolean {
|
||||
for (const value of Object.values(char.data)) {
|
||||
if (value === '' || value === undefined || value === null || value === 0) continue;
|
||||
if (Array.isArray(value)) {
|
||||
if (value.length === 0) continue;
|
||||
if (value.length === 1 && DEFAULT_LANGUAGES.includes(value[0])) continue;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue