Skip to content

Commit

Permalink
Add libdef for pretty-ms (#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
NameFILIP authored and marudor committed Aug 9, 2017
1 parent c490a98 commit 872f3c9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions definitions/npm/pretty-ms_v3.x.x/flow_v0.25.x-/pretty-ms_v3.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type Options = {
secDecimalDigits?: number,
msDecimalDigits?: number,
compact?: boolean,
verbose?: boolean
};

declare module 'pretty-ms' {
declare module.exports: (ms: number, opts?: Options) => string;
}
25 changes: 25 additions & 0 deletions definitions/npm/pretty-ms_v3.x.x/test_pretty-ms_v3.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// @flow

import prettyMs from 'pretty-ms';

prettyMs(1502217145948);
prettyMs(1502217145948, { verbose: true });
prettyMs(1502217145948, { compact: true });
prettyMs(1502217145948, { msDecimalDigits: 2 });
prettyMs(1502217145948, { secDecimalDigits: 2 });
prettyMs(1502217145948, { verbose: true, compact: true, msDecimalDigits: 2, secDecimalDigits: 2 });

// $ExpectError
prettyMs('text');

// $ExpectError
prettyMs({});

// $ExpectError
prettyMs(null);

// $ExpectError
prettyMs();

// $ExpectError
prettyMs(1502217145948, null);

0 comments on commit 872f3c9

Please sign in to comment.