Skip to content

Commit

Permalink
add type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
abranhe committed Jul 26, 2019
1 parent 30cafff commit 01ce61c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 4 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { expectType } from 'tsd';
import sTo = require('.');

expectType<object>(sTo('a: a, b: b, c: 3, d: 7'));

0 comments on commit 01ce61c

Please sign in to comment.