sprintf-ts
v0.1.0
Published
TypeScript utils for sprintf
Downloads
171
Readme
sprintf-ts
sprintf TypeScript utils.
API
parseParams(format: string): TsParam[]
Parse params from a sprintf format.
Usage
import { parseParams } from 'sprintf-ts'
let params = parseParams('Hello %1$s, %s, %2$s, %s');
// = [{ name: 'p1', type: ['string'] }, { name: 'p2', type: ['string'] }]
params = parseParams('Hello %(name)s');
// = [{ name: 'p1', type: ['{ name: string }'] }]
Types
type TsParam = {
name: string
type: string[]
}