@qii404/redis-splitargs
v1.0.1
Published
Splitting arguments like a ninja, hex support, original author is zihua.li, forked by qii404
Downloads
129
Readme
splitargs
Splitting Redis arguments as redis-cli
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();