mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-12 18:56:01 +00:00
Initial commit
This commit is contained in:
26
assets/js/hooks/Mapper/helpers/parseSignatures.ts
Normal file
26
assets/js/hooks/Mapper/helpers/parseSignatures.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { COSMIC_SIGNATURE } from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures';
|
||||
import { SystemSignature } from '@/hooks/Mapper/types';
|
||||
|
||||
export const parseSignatures = (value: string, availableKeys: string[]): SystemSignature[] => {
|
||||
const outArr: SystemSignature[] = [];
|
||||
const rows = value.split('\n');
|
||||
|
||||
for (let a = 0; a < rows.length; a++) {
|
||||
const row = rows[a];
|
||||
|
||||
const sigArrInfo = row.split(' ');
|
||||
|
||||
if (sigArrInfo.length !== 6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
outArr.push({
|
||||
eve_id: sigArrInfo[0],
|
||||
kind: availableKeys.includes(sigArrInfo[1]) ? sigArrInfo[1] : COSMIC_SIGNATURE,
|
||||
group: sigArrInfo[2],
|
||||
name: sigArrInfo[3],
|
||||
});
|
||||
}
|
||||
|
||||
return outArr;
|
||||
};
|
||||
Reference in New Issue
Block a user