mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #8426 from kruncher/master
Add escape-string-regexp and format-unicorn type definitions.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
/// <reference path="escape-string-regexp.d.ts"/>
|
||||
|
||||
import escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
var inputString: string = '^abc$';
|
||||
var outputString: string;
|
||||
|
||||
outputString = escapeStringRegexp(inputString);
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for escape-string-regexp
|
||||
// Project: https://github.com/sindresorhus/escape-string-regexp
|
||||
// Definitions by: kruncher <https://github.com/kruncher/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "escape-string-regexp" {
|
||||
|
||||
function escapeStringRegexp(str: string): string;
|
||||
|
||||
export = escapeStringRegexp;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="format-unicorn-safe.d.ts"/>
|
||||
|
||||
import formatUnicorn = require('format-unicorn/safe');
|
||||
|
||||
// Safe version
|
||||
var outputString: string;
|
||||
|
||||
outputString = formatUnicorn('Hello, {name}; you have {favoriteNumber}', {
|
||||
name: "kruncher",
|
||||
favoriteNumber: 42
|
||||
});
|
||||
+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
|
||||
|
||||
declare module 'format-unicorn/safe' {
|
||||
|
||||
function formatUnicornSafe(str: string, replacements: { }): string;
|
||||
|
||||
export = formatUnicornSafe;
|
||||
|
||||
}
|
||||
@@ -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