New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arg-analyser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arg-analyser

A simple configurable string analyser to get elements from command like string

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

Arg Analyser

Version Maintenance License: MIT

A simple configurable string analyser to get elements from command like string.

  • Split the string by space
  • Don't split string between quotes
  • Recursive group

How to use it

import { Analyser } from "arg-analyser";

const sample = `Lorem ipsum "dolor sit amet, consectetur" adipiscing (elit. [In id {fermentum mi.}] Curabitur) viverra, 'justo \\'nec viver"ra' mollis, lec"tus massa."`;

// Perform a one shot analyse
const args = Analyser.analyse(sample, {
    delimiters: [
        ["(", ")"],
        ["[", "]"],
        ["{", "}"],
    ],
});

// Instantiate a Analyse object to re-use it
const analyser = new Analyser({
    delimiters: [
        ["(", ")"],
        ["[", "]"],
        ["{", "}"],
    ],
});

const args1 = analyser.analyse("hello world !");
const args2 = analyser.analyse(sample);

Example

To run the example script :

  1. Clone this repository git clone https://github.com/tguichaoua/arg-analyser.git
  2. Enter in the directory cd arg-analyser
  3. Install dependencies npm install
  4. Run the example script npm run example
========================================
hello world !
----------------------------------------
├ ∅  hello
├ ∅  world
├ ∅  !
========================================
"hello world" !
----------------------------------------
├ "  hello world
├ ∅  !
========================================
[deep (in {the (rabbit [hole])})]
----------------------------------------
├ [ ]
│  ├ ∅  deep
│  ├ ( )
│  │  ├ ∅  in
│  │  ├ { }
│  │  │  ├ ∅  the
│  │  │  ├ ( )
│  │  │  │  ├ ∅  rabbit
│  │  │  │  ├ [ ]
│  │  │  │  │  ├ ∅  hole
========================================

📝 License

Copyright © 2021 Tristan Guichaoua.
This project is MIT licensed.

Keywords

FAQs

Package last updated on 19 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc