mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add format-unicorn type definition.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/// <reference path="format-unicorn-safe.d.ts"/>
|
||||
|
||||
import formatUnicorn from 'format-unicorn/safe';
|
||||
|
||||
// Safe version
|
||||
var outputString: string;
|
||||
|
||||
outputString = formatUnicorn('Hello, {name}; you have {favoriteNumber}', {
|
||||
name: "kruncher",
|
||||
favoriteNumber: 42
|
||||
});
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for format-unicorn
|
||||
// Project: https://github.com/tallesl/format-unicorn
|
||||
// Definitions by: kruncher <https://github.com/kruncher/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'format-unicorn/safe' {
|
||||
|
||||
export default function (str: string, replacements: { }): string;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="format-unicorn.d.ts"/>
|
||||
|
||||
import 'format-unicorn';
|
||||
|
||||
// Unsafe version
|
||||
var outputString: string;
|
||||
|
||||
outputString = 'Hello, {name}; you have {favoriteNumber}'.formatUnicorn({
|
||||
name: "kruncher",
|
||||
favoriteNumber: 42
|
||||
});
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for format-unicorn
|
||||
// Project: https://github.com/tallesl/format-unicorn
|
||||
// Definitions by: kruncher <https://github.com/kruncher/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface String {
|
||||
formatUnicorn(replacements: { }): string;
|
||||
}
|
||||
|
||||
declare module "format-unicorn" {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user