diff --git a/index.d.ts b/index.d.ts index e69de29..ab5043c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -0,0 +1,17 @@ +/** + * Convert an string into an object. + * + * @param {string} input the string object + * @returns {object} the object similar to JSON.parse + * + * @example + * ``` + * import sTo = require('s-to-o'); + * + * sTo('a: a, b: b, c: 3, d: 7') + * // => { a: 'a', b: 'b', c: 3, d: 7 } + * ``` + */ +declare function sTo(input: string): object + +export = sTo; \ No newline at end of file diff --git a/index.test-d.ts b/index.test-d.ts index e69de29..b4b223c 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -0,0 +1,4 @@ +import { expectType } from 'tsd'; +import sTo = require('.'); + +expectType(sTo('a: a, b: b, c: 3, d: 7')); \ No newline at end of file