Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    string-interpolatepublic

    String interpolate

    Simple string interpolation

    Install

    • via npm npm install string-interpolate
    • via component component install alexeyraspopov/string-interpolate
    • via bower bower install string-interpolate

    API

    interpolate(template, data);
    
    • template - template string. Default delimiters are {}
    • data - simple object

    Usage

    var interpolate = require('string-interpolate');
    
    interpolate('{ greeting }, { user.name }', {
    	greeting: 'Hello',
    	user: {
    		name: 'Jane'
    	}
    });
    

    If data is not specified - returns template function

    var greet = interpolate('Hello { name }');
    
    greet({ name: 'Jane' }); // Hello Jane
    greet({ name: 'Mike' }); // Hello Mike
    

    License

    MIT License (c) Alexey Raspopov

    Keywords

    none

    install

    npm i string-interpolate

    Downloadsweekly downloads

    585

    version

    0.4.0

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar