mongo-key-escape
Version:
Escape mongo keys for periods and dollar signs
28 lines (18 loc) • 475 B
Markdown
[](http://docs.mongodb.org/manual/faq/developers/#faq-dollar-sign-escaping) for characters `.` and `$`.
$ npm install mongo-key-escape
```js
var key = require('mongo-key-escape');
key.escape('event.thing');
// event\uFF0Ething
key.unescape('event\uFF0Ething');
// 'event.thing'
key.escape('event$thing');
// event\uFF04thing
key.unescape('event\uFF04thing');
// 'event$thing'
```
MIT