Skip to content

Does not accept placeholder names that begin with underscore ('_') #6

Open
@rmullenix

Description

@rmullenix

When the parameter names lead with an underscore, they are ignored by the system.

'use strict';
const nph = require('named-placeholders')();

let query = 'SELECT 1 + :_foo + :bar;';
let params = {'_foo': 2, 'bar': 3 };

let q = nph(query, params);

console.log(q[0]);  // SELECT 1 + :_foo + ?;
console.log(q[1]); // [ 3 ]

MySQL allows for column names to lead with an underscore and Javascript allows for Object properties to lead with an underscore, so this should be supported behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions