mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-31 11:40:47 +08:00
Merge pull request #5453 from marcinporebski/master
url template and string score
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
/// <reference path="string_score.d.ts" />
|
||||
|
||||
import string_score = require('string_score');
|
||||
|
||||
var a = 'abc';
|
||||
var b = 'xyz';
|
||||
|
||||
console.log(a.score(b).toString());
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for string_score 0.1.22
|
||||
// Project: https://github.com/joshaven/string_score
|
||||
// Definitions by: Marcin Porębski <https://github.com/marcinporebski/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "string_score"
|
||||
{
|
||||
// nothing here as it's only extending the build in String class
|
||||
}
|
||||
|
||||
interface String {
|
||||
score: (word: string, fuzzy?: number) => number;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="url-template.d.ts" />
|
||||
|
||||
|
||||
import urlTemplate = require('url-template');
|
||||
|
||||
var emailUrl = urlTemplate.parse('/{email}/{folder}/{id}');
|
||||
|
||||
// Returns '/user@domain/test/42'
|
||||
emailUrl.expand({
|
||||
email: 'user@domain',
|
||||
folder: 'test',
|
||||
id: 42
|
||||
});
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for url-template 2.0.6
|
||||
// Project: https://github.com/bramstein/url-template
|
||||
// Definitions by: Marcin Porębski <https://github.com/marcinporebski/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module UrlTemplate
|
||||
{
|
||||
interface TemplateParser {
|
||||
parse(template: string): Template;
|
||||
}
|
||||
|
||||
interface Template {
|
||||
expand(parameters: any): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "url-template"
|
||||
{
|
||||
var urlTemplate: UrlTemplate.TemplateParser;
|
||||
|
||||
export = urlTemplate;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user