npm.io
0.9.1 • Published 8 months ago

@sourcelib/kv

Licence
GPL-3.0
Version
0.9.1
Deps
0
Size
67 kB
Vulns
0
Weekly
0
Stars
5

@sourcelib/kv

Typescript library to tokenize, parse, inspect, analyse, reformat and do other language integrations for source engine keyvalue files.

Installation

npm install @sourcelib/kv

Usage

import { tokenize, parse } from '@sourcelib/kv';

const tokens = tokenize(`
"KV" {
    "key" "value"
    "key2" "value2"
}`);

const kvTree = parse(tokens);
kvTree.getChildren()[0].getValues()[0].getValue(); // "value"