aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-01-09 08:35:12 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-01-09 08:35:12 +0800
commit734cf5819aee5d46719d1ca387666bfda6e475bd (patch)
tree264785cb0666e011b49842b47ac4b2408dddaa28 /packages/utils
parent9f3acf8e2888b6105062e47664ecd5adaaf3c889 (diff)
parent35e0b6143ab1405259471e1c9c698bfcd869df5a (diff)
downloaddexon-sol-tools-734cf5819aee5d46719d1ca387666bfda6e475bd.tar
dexon-sol-tools-734cf5819aee5d46719d1ca387666bfda6e475bd.tar.gz
dexon-sol-tools-734cf5819aee5d46719d1ca387666bfda6e475bd.tar.bz2
dexon-sol-tools-734cf5819aee5d46719d1ca387666bfda6e475bd.tar.lz
dexon-sol-tools-734cf5819aee5d46719d1ca387666bfda6e475bd.tar.xz
dexon-sol-tools-734cf5819aee5d46719d1ca387666bfda6e475bd.tar.zst
dexon-sol-tools-734cf5819aee5d46719d1ca387666bfda6e475bd.zip
Merge branch 'development' into fix/mutatedInput
* development: Changes to abi-gen after code review Added constructor ABIs to abi-gen Describe #295 in a CHANGELOG Add #302 description to changelog Fix formatting Apply prettier config Install prettier Remove formatting esilnt rules sendTransactionAsync should return txHash string Added Event generation to abi-gen Publish Add dates to CHANGELOG entries Update subproviders CHANGELOG Support both personal_sign and eth_sign Fix Ledger tests given change from `personal_sign` to `eth_sign` Update subprovider to catch correct RPC method Rename guide Update contribution guide Fix broken links in the abi-gen README Fix typing generation for arrays in which types separated by |s
Diffstat (limited to 'packages/utils')
-rw-r--r--packages/utils/package.json4
-rw-r--r--packages/utils/src/address_utils.ts6
-rw-r--r--packages/utils/src/index.ts10
-rw-r--r--packages/utils/src/promisify.ts11
4 files changed, 14 insertions, 17 deletions
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 729cd5f9f..815006170 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/utils",
- "version": "0.1.1",
+ "version": "0.1.2",
"description": "0x TS utils",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -19,7 +19,7 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/utils/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^0.3.0",
+ "@0xproject/tslint-config": "^0.4.0",
"@types/lodash": "^4.14.86",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
diff --git a/packages/utils/src/address_utils.ts b/packages/utils/src/address_utils.ts
index bdbcd3a89..f94985441 100644
--- a/packages/utils/src/address_utils.ts
+++ b/packages/utils/src/address_utils.ts
@@ -11,8 +11,10 @@ export const addressUtils = {
for (let i = 0; i < 40; i++) {
// The nth letter should be uppercase if the nth digit of casemap is 1
- if ((parseInt(addressHash[i], 16) > 7 && unprefixedAddress[i].toUpperCase() !== unprefixedAddress[i]) ||
- (parseInt(addressHash[i], 16) <= 7 && unprefixedAddress[i].toLowerCase() !== unprefixedAddress[i])) {
+ if (
+ (parseInt(addressHash[i], 16) > 7 && unprefixedAddress[i].toUpperCase() !== unprefixedAddress[i]) ||
+ (parseInt(addressHash[i], 16) <= 7 && unprefixedAddress[i].toLowerCase() !== unprefixedAddress[i])
+ ) {
return false;
}
}
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 403bc7236..ca3219f10 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -1,5 +1,5 @@
-export {promisify} from './promisify';
-export {addressUtils} from './address_utils';
-export {classUtils} from './class_utils';
-export {intervalUtils} from './interval_utils';
-export {bigNumberConfigs} from './bignumber_config';
+export { promisify } from './promisify';
+export { addressUtils } from './address_utils';
+export { classUtils } from './class_utils';
+export { intervalUtils } from './interval_utils';
+export { bigNumberConfigs } from './bignumber_config';
diff --git a/packages/utils/src/promisify.ts b/packages/utils/src/promisify.ts
index c114cf32f..29d626b61 100644
--- a/packages/utils/src/promisify.ts
+++ b/packages/utils/src/promisify.ts
@@ -5,16 +5,11 @@ import * as _ from 'lodash';
* Promisify provides a default callback of the form (error, result) and rejects when `error` is not null. You can also
* supply thisArg object as the second argument which will be passed to `apply`.
*/
-export function promisify<T>(
- originalFn: (
- ...args: any[],
- // HACK: This can't be properly typed without variadic kinds https://github.com/Microsoft/TypeScript/issues/5453
- ) => void,
- thisArg?: any,
-): (...callArgs: any[]) => Promise<T> {
+// HACK: This can't be properly typed without variadic kinds https://github.com/Microsoft/TypeScript/issues/5453
+export function promisify<T>(originalFn: (...args: any[]) => void, thisArg?: any): (...callArgs: any[]) => Promise<T> {
const promisifiedFunction = async (...callArgs: any[]): Promise<T> => {
return new Promise<T>((resolve, reject) => {
- const callback = (err: Error|null, data?: T) => {
+ const callback = (err: Error | null, data?: T) => {
_.isNull(err) ? resolve(data) : reject(err);
};
originalFn.apply(thisArg, [...callArgs, callback]);