Skip to content

Instantly share code, notes, and snippets.

@r4phf43l
Forked from rmariuzzo/sprintf.js
Last active November 8, 2020 01:17
Show Gist options
  • Save r4phf43l/dc5bf0805b287c41afffd5b131ddbdae to your computer and use it in GitHub Desktop.
Save r4phf43l/dc5bf0805b287c41afffd5b131ddbdae to your computer and use it in GitHub Desktop.
Simple and minimal `sprintf` function in JavaScript.
const sprintf = ( format, ...args ) => ( i = 0, format.replace( /%s/g, () => args[i++] ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment