forked from alainbryden/bitburner-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-list.js
More file actions
11 lines (11 loc) · 758 Bytes
/
get-list.js
File metadata and controls
11 lines (11 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
const lists = ['FactionName', 'StockSymbol', 'GangName', 'Crime', 'AugmentName', 'BladeburnerOperations', 'BladeburnerBlackOps', 'CodingContractTypes', 'GangEquipment'].sort();
export function autocomplete() { return lists; }
/** @param {NS} ns **/
export async function main(ns) { ns.tprint(await getList(ns.args[0])); }
export async function getList(listName) {
let definitions = await (await fetch('https://raw.githubusercontent.com/danielyxie/bitburner/dev/src/ScriptEditor/NetscriptDefinitions.d.ts')).text();
let listStart = `type ${listName} =\n | "`;
let listIndex = definitions.indexOf(listStart) + listStart.length;
let list = definitions.slice(listIndex, definitions.indexOf('";', listIndex)).split('"\n | "');
return list;
}