alexei / sprintf.js

sprintf.js is a complete open source JavaScript sprintf implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Padding with custom char fails

retorquere opened this issue · comments

Unless I'm misunderstanding the docs, this should work, but it errors out with

SyntaxError: [sprintf] unexpected placeholder
at Function.sprintf.parse (/Users/emile/github/better-bibtex/node_modules/sprintf-js/src/sprintf.js:164:23)
at sprintf (/Users/emile/github/better-bibtex/node_modules/sprintf-js/src/sprintf.js:19:34)
at Object. (/Users/emile/github/better-bibtex/ext.js:5:13)

const sprintf = require('sprintf-js').sprintf
var a = {
    name: 'a',
}
console.log(sprintf("Hello %'a2(name)s", a))

Never mind, this works:

const sprintf = require('sprintf-js').sprintf
var a = { a: 'a' }
console.log(sprintf("Hello %(a)'a2s", a))