Merge pull request #5453 from marcinporebski/master

url template and string score
This commit is contained in:
Masahiro Wakame
2015-08-26 01:25:37 +09:00
4 changed files with 58 additions and 0 deletions
+8
View File
@@ -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());
+13
View File
@@ -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;
}
+13
View File
@@ -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
});
+24
View File
@@ -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;
}