0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/core/shared/nql-map-key-values
..
index.js
package.json
README.md

nql-map-key-values

This utility returns a transformer which can be passed to the @nexes/nql library to transform queries

Usage

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}