arc-flag-parser

<a href="https://www.ebay.com"> <img src="https://img.shields.io/badge/ebay-open%20source-01d5c2.svg" alt="ebay open source"/> </a> <a href="https://img.shields.io/github/license/eBay/arc.svg"> <img src="https://img.shields.io/github/license/eBay/ar

Usage no npm install needed!

<script type="module">
  import arcFlagParser from 'https://cdn.skypack.dev/arc-flag-parser';
</script>

README

arc-flag-parser

ebay open source MIT licensed travisci build Codecov npm version downloads

Parse arc flag expressions to arrays of flag matches

Syntax

  • + represents AND
  • , represents OR
  • AND (+) has higher precedence than OR (,)
  • [] is used to increase the precedence of the wrapped group

Examples

import { parse } from 'arc-flag-parser';
parse('mobile+ios') // [ ['mobile', 'ios'] ]
import { parse } from 'arc-flag-parser';
parse('mobile,ios') // [ ['mobile'], ['ios'] ]
import { parse } from 'arc-flag-parser';
parse('mobile+[ios,android]') // [ ['mobile', 'ios'], ['mobile', 'android'] ]

See test.js for more examples