mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
27 lines
536 B
Markdown
27 lines
536 B
Markdown
|
# nql-map-key-values
|
||
|
|
||
|
This utility returns a transformer which can be passed to the `@nexes/nql` library to transform queries
|
||
|
|
||
|
### Usage
|
||
|
|
||
|
```js
|
||
|
const nql = require('@nexes/nql');
|
||
|
const mapKeyValues = require('nql-map-key-values');
|
||
|
|
||
|
nql('good:true', {
|
||
|
transformer: mapKeyValues({
|
||
|
key: {
|
||
|
from: 'good',
|
||
|
to: 'bad'
|
||
|
},
|
||
|
values: [{
|
||
|
from: true,
|
||
|
to: false
|
||
|
}, {
|
||
|
from: false,
|
||
|
to: true
|
||
|
}]
|
||
|
});
|
||
|
}).toJSON(); // => {bad: false}
|
||
|
```
|