mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
committed by
Ron Buckton
parent
62b83bada6
commit
5afa9902c6
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for uslug 1.0
|
||||
// Project: https://github.com/jeremys/uslug
|
||||
// Definitions by: Junyoung Choi <https://github.com/rokt33r>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Generate a slug for the string passed.
|
||||
* @param value The string you want to slugify
|
||||
* @param options An optional object that can contain:
|
||||
* - allowedChars: a String of chars that you want to be whitelisted. Default: '-_~'.
|
||||
* - lower: a Boolean to force to lower case the slug. Default: true.
|
||||
* - spaces: a Boolean to allow spaces. Default: false.
|
||||
*/
|
||||
declare function uslug(value: string, options?: uslug.UslugOptions): string;
|
||||
|
||||
declare namespace uslug {
|
||||
interface UslugOptions {
|
||||
allowedChars?: string;
|
||||
lower?: boolean;
|
||||
spaces?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = uslug;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"uslug-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import uslug = require("uslug");
|
||||
|
||||
uslug('Быстрее и лучше!'); // 'быстрее-и-лучше'
|
||||
uslug('汉语/漢語'); // '汉语漢語'
|
||||
|
||||
uslug('Y U NO', { lower: false }); // 'Y-U-NO'
|
||||
uslug('Y U NO', { spaces: true }); // 'y u no'
|
||||
uslug('Y-U|NO', { allowedChars: '|' }); // 'yu|no'
|
||||
Reference in New Issue
Block a user