node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey ยป


๐ŸŒˆ Format Unicorn

A string format function made and used by Stack Exchange on their various websites. * *


$ npm install format-unicorn
$ node
> require('format-unicorn') // this adds formatUnicorn to String.prototype
> 'We are not in {place} anymore.'.formatUnicorn({ place: 'Kansas' })
'We are not in Kansas anymore.'
> let formatUnicorn = require('format-unicorn/safe') // 'safer' version if you don't wanna mess with String's prototype
> formatUnicorn('We are not in {place} anymore.', { place: 'Kansas' })
'We are not in Kansas anymore.'