Giter Site home page Giter Site logo

marques-work / shellwords Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jimmycuadra/shellwords

2.0 3.0 0.0 316 KB

Manipulate strings according to the word parsing rules of the UNIX Bourne shell.

License: MIT License

TypeScript 70.59% JavaScript 29.41%

shellwords's Introduction

Shellwords-TS

Build Status

A JavaScript port of the Ruby module of the same name, with TypeScript typings. Shellwords provides functions to manipulate strings according to the word parsing rules of the UNIX Bourne shell. Originally forked from jimmycuadra/shellwords, this package is updated to be at parity with a modern reference implementation (Ruby 3.1.2 at the time of writing) and implements Shellwords.join(), which was missing from the original package. The goal of this is to maintain parity with the Ruby Shellwords module, so if there is a discrepancy, please file a bug (or even better, a PR).

Installation

Add "shellwords-ts" to your package.json file and run npm install.

Example

import Shellwords from "shellwords-ts";

Shellwords.split("foo 'bar baz'"); // ["foo", "bar baz"]
Shellwords.escape("What's up?"); // "What\\'s\\ up\\?"
Shellwords.join(["find", "~/Library/Application Support", "-name", "*.plist"]); // "find \\~/Library/Application\\ Support -name \\*.plist"

Shellwords.split("foo 'bar baz' quu", (rawPart) => {
  // have access to the chunks of the raw string as it is scanned
});

Breaking changes as of 3.0.0:

shellwords's People

Contributors

ixti avatar jimmycuadra avatar marques-work avatar wtgtybhertgeghgtwtg avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.