@qii404/redis-splitargs

1.0.1 • Public • Published

splitargs

Splitting Redis arguments as redis-cli

Build Status Join the chat at https://gitter.im/luin/splitargs

Install

$ npm install redis-splitargs

Usage

var s = require('redis-splitargs');

expect(s('set foo bar')).to.eql(['set', 'foo', 'bar']);
expect(s('set "foo bar"')).to.eql(['set', 'foo bar']);
expect(s('set "foo bar\\" baz"')).to.eql(['set', 'foo bar" baz']);
expect(s('set \\  bar')).to.eql(['set', '\\', 'bar']);
expect(s('  set    foo  \r \n  bar  \v ')).to.eql(['set', 'foo', 'bar']);
expect(s('"set" "foo" "bar"')).to.eql(['set', 'foo', 'bar']);

expect(function () { s('set foo "bar'); }).to.throw();
expect(function () { s('set foo "bar"dsf'); }).to.throw();
expect(function () { s("set foo 'bar"); }).to.throw();

Readme

Keywords

Package Sidebar

Install

npm i @qii404/redis-splitargs

Weekly Downloads

14

Version

1.0.1

License

MIT

Unpacked Size

6.89 kB

Total Files

6

Last publish

Collaborators

  • qii404