Add tslint (#151)

This commit is contained in:
Jaco Greeff
2018-06-27 10:15:46 +02:00
committed by GitHub
parent 499a877f15
commit 73477a2809
134 changed files with 989 additions and 884 deletions
+12 -12
View File
@@ -8,18 +8,18 @@ import isFunction from './is/function';
type MessageFn = () => string;
/**
@name assert
@signature assert (test: any, message: string | () => string, code: number = ExtError.CODES.ASSERT, data: any): void
@summary Checks for a valid test, if not ExtError is thrown.
@description
Checks that `test` is a truthy value. If value is falsy (`null`, `undefined`, `false`, ...), it throws an ExtError with the supplied `message` and an optional `code` and `data`. When `test` passes, `true` is returned.
@example
const assert from '@polkadot/util/assert');
assert(true, 'True should be true'); // true returned
assert(false, 'False should not be true'); // ExtError thrown
assert(false, () => 'message'); // ExtError with 'message'
*/
* @name assert
* @signature assert (test: any, message: string | () => string, code: number = ExtError.CODES.ASSERT, data: any): void
* @summary Checks for a valid test, if not ExtError is thrown.
* @description
* Checks that `test` is a truthy value. If value is falsy (`null`, `undefined`, `false`, ...), it throws an ExtError with the supplied `message` and an optional `code` and `data`. When `test` passes, `true` is returned.
* @example
* const assert from '@polkadot/util/assert');
*
* assert(true, 'True should be true'); // true returned
* assert(false, 'False should not be true'); // ExtError thrown
* assert(false, () => 'message'); // ExtError with 'message'
*/
export default function assert (test: any, message: string | MessageFn, code: number = ExtError.CODES.ASSERT, data?: any): boolean {
if (test) {
return true;