Skip to content

TypeError: format is not a function #15

@sandeepraju

Description

@sandeepraju

I'm not sure if there is something broken or I am doing it wrong, but the basic example in the docs fail.

 $ node    
> var format = require('string-format');
undefined
> format('hello, {}', 'world');  // works
'hello, world'
> 'hello, {}'.format('world');  // doesn't work
TypeError: "hello, {}".format is not a function
    at repl:1:13
    at REPLServer.defaultEval (repl.js:248:27)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:412:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
    at REPLServer.Interface._line (readline.js:549:8)
    at REPLServer.Interface._ttyWrite (readline.js:826:14)

Installed the library from npm. This is the version I have in my package.json:

"string-format": "^0.5.0"

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