1.0.1 โข Published 10 months ago
posixparser v1.0.1
Parse Posix-Style Arguments in JS - Rewrite of this old gist of mine
๐ฆ Table of Contents
๐ Setup
pnpm i posixparser
๐ ๏ธ Usage
import PosixParser, {Options as PosixOptions} from 'posixparser'
const options = new Options({
pushQuotes: false,
pushEscapes: false,
pushBlankWhitespace: false,
});
const parser = new PosixParser(options); // options can also be passed as a 2nd arg to parse()
const input = `"hello world" hello hi 'hello there'`
const output = parser.parse(input);
console.log(output); // ["hello world", "hello", "hi", "hello there"]
๐ License
This project is licensed under the ๐ MIT License
๐ See Also
- ๐ฆ ๐ @3xpo/argparser โ Parse a string[] of arguments into an object