Skip to content

Properties with underscore not working in compile mode #18

@ksmithut

Description

@ksmithut

Using version 1.0.0 on node v6.9.4:

const format = require("string-template")
const compile = require("string-template/compile")

const vars = {
  hostName: 'my.only.host.com',
  host_tenant: 'only',
  host_lane: 'prd',
  subdomain: 'my.only',
}

console.log(format('http://{hostName}-{host_tenant}-{host_lane}-{subdomain}', vars))
// Logs out "http://my.only.host.com-only-prd-my.only"

const template = compile('http://{hostName}-{host_tenant}-{host_lane}-{subdomain}')
console.log(template(vars))
// Logs out "http://my.only.host.com-{host_tenant}-{host_lane}-my.only"

Can be reproduced here: https://runkit.com/58827adb4ddfcf0014890d06/58827adb4ddfcf0014890d07

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions