diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-18 22:22:58 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-18 22:45:39 +0800 |
commit | 9b0f68f9a99574917616001b6cd95d54cb263df4 (patch) | |
tree | c00041cac1adc671243de5f091ad2c90e8033da8 | |
parent | f4eb73ca7cd7451e4ea00eee84e8ab3909cd8b36 (diff) | |
download | dexon-0x-contracts-9b0f68f9a99574917616001b6cd95d54cb263df4.tar.gz dexon-0x-contracts-9b0f68f9a99574917616001b6cd95d54cb263df4.tar.zst dexon-0x-contracts-9b0f68f9a99574917616001b6cd95d54cb263df4.zip |
Include only used lodash functions
-rw-r--r-- | package.json | 5 | ||||
-rw-r--r-- | src/0x.ts | 2 | ||||
-rw-r--r-- | src/contract.ts | 2 | ||||
-rw-r--r-- | src/contract_wrappers/contract_wrapper.ts | 2 | ||||
-rw-r--r-- | src/contract_wrappers/ether_token_wrapper.ts | 2 | ||||
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 2 | ||||
-rw-r--r-- | src/contract_wrappers/token_registry_wrapper.ts | 2 | ||||
-rw-r--r-- | src/contract_wrappers/token_transfer_proxy_wrapper.ts | 2 | ||||
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 2 | ||||
-rw-r--r-- | src/utils/abi_decoder.ts | 2 | ||||
-rw-r--r-- | src/utils/assert.ts | 2 | ||||
-rw-r--r-- | src/utils/decorators.ts | 2 | ||||
-rw-r--r-- | src/utils/exchange_transfer_simulator.ts | 2 | ||||
-rw-r--r-- | src/utils/filter_utils.ts | 2 | ||||
-rw-r--r-- | src/utils/interval_utils.ts | 2 | ||||
-rw-r--r-- | src/utils/lodash.ts | 55 | ||||
-rw-r--r-- | src/utils/order_validation_utils.ts | 2 | ||||
-rw-r--r-- | src/utils/utils.ts | 2 | ||||
-rw-r--r-- | src/web3_wrapper.ts | 2 | ||||
-rw-r--r-- | test/0x.js_test.ts | 2 | ||||
-rw-r--r-- | test/token_registry_wrapper_test.ts | 2 | ||||
-rw-r--r-- | test/utils/order_factory.ts | 2 | ||||
-rw-r--r-- | test/utils/token_utils.ts | 2 | ||||
-rw-r--r-- | webpack.config.js | 3 | ||||
-rw-r--r-- | yarn.lock | 82 |
25 files changed, 128 insertions, 59 deletions
diff --git a/package.json b/package.json index 852f3db6c..bd21db632 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,8 @@ }, "devDependencies": { "@types/jsonschema": "^1.1.1", - "@types/lodash": "^4.14.64", + "@types/lodash": "^4.14.77", + "@types/lodash-es": "^4.14.7", "@types/mocha": "^2.2.41", "@types/node": "^8.0.1", "@types/sinon": "^2.2.2", @@ -100,7 +101,7 @@ "ethereumjs-util": "^5.1.1", "find-versions": "^2.0.0", "js-sha3": "^0.6.1", - "lodash": "^4.17.4", + "lodash-es": "4.14.7", "publish-release": "^1.3.3", "uuid": "^3.1.0", "web3": "^0.20.0" @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from './utils/lodash'; import * as BigNumber from 'bignumber.js'; import {SchemaValidator, schemas} from '0x-json-schemas'; import {bigNumberConfigs} from './bignumber_config'; diff --git a/src/contract.ts b/src/contract.ts index 1aacc65dc..5bf8150ac 100644 --- a/src/contract.ts +++ b/src/contract.ts @@ -1,5 +1,5 @@ import * as Web3 from 'web3'; -import * as _ from 'lodash'; +import {_} from './utils/lodash'; import promisify = require('es6-promisify'); import {SchemaValidator, schemas} from '0x-json-schemas'; import {AbiType} from './types'; diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts index 19dccc6f2..3b83f269f 100644 --- a/src/contract_wrappers/contract_wrapper.ts +++ b/src/contract_wrappers/contract_wrapper.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import * as Web3 from 'web3'; import {BlockAndLogStreamer, Block} from 'ethereumjs-blockstream'; import {Web3Wrapper} from '../web3_wrapper'; diff --git a/src/contract_wrappers/ether_token_wrapper.ts b/src/contract_wrappers/ether_token_wrapper.ts index f15e766f0..ba694b408 100644 --- a/src/contract_wrappers/ether_token_wrapper.ts +++ b/src/contract_wrappers/ether_token_wrapper.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import {Web3Wrapper} from '../web3_wrapper'; import {ContractWrapper} from './contract_wrapper'; import {TokenWrapper} from './token_wrapper'; diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index bc0ac0634..739e1df3b 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import * as Web3 from 'web3'; import * as BigNumber from 'bignumber.js'; import {schemas} from '0x-json-schemas'; diff --git a/src/contract_wrappers/token_registry_wrapper.ts b/src/contract_wrappers/token_registry_wrapper.ts index 2cc5a9aa0..3b03da2cf 100644 --- a/src/contract_wrappers/token_registry_wrapper.ts +++ b/src/contract_wrappers/token_registry_wrapper.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import {Web3Wrapper} from '../web3_wrapper'; import {assert} from '../utils/assert'; import {Token, TokenRegistryContract, TokenMetadata} from '../types'; diff --git a/src/contract_wrappers/token_transfer_proxy_wrapper.ts b/src/contract_wrappers/token_transfer_proxy_wrapper.ts index f81845af9..c7419acd6 100644 --- a/src/contract_wrappers/token_transfer_proxy_wrapper.ts +++ b/src/contract_wrappers/token_transfer_proxy_wrapper.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import {Web3Wrapper} from '../web3_wrapper'; import {ContractWrapper} from './contract_wrapper'; import {artifacts} from '../artifacts'; diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 8dc4e61c5..3f38623aa 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import * as BigNumber from 'bignumber.js'; import {schemas} from '0x-json-schemas'; import {Web3Wrapper} from '../web3_wrapper'; diff --git a/src/utils/abi_decoder.ts b/src/utils/abi_decoder.ts index a6c45bee7..7d0fa8b94 100644 --- a/src/utils/abi_decoder.ts +++ b/src/utils/abi_decoder.ts @@ -1,5 +1,5 @@ import * as Web3 from 'web3'; -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import * as BigNumber from 'bignumber.js'; import {AbiType, DecodedLogArgs, LogWithDecodedArgs, RawLog, SolidityTypes, ContractEventArgs} from '../types'; import * as SolidityCoder from 'web3/lib/solidity/coder'; diff --git a/src/utils/assert.ts b/src/utils/assert.ts index 099f4490f..871553ccf 100644 --- a/src/utils/assert.ts +++ b/src/utils/assert.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import * as BigNumber from 'bignumber.js'; import * as Web3 from 'web3'; import {Web3Wrapper} from '../web3_wrapper'; diff --git a/src/utils/decorators.ts b/src/utils/decorators.ts index ec750b891..6e803d985 100644 --- a/src/utils/decorators.ts +++ b/src/utils/decorators.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import {constants} from './constants'; import {AsyncMethod, ZeroExError} from '../types'; diff --git a/src/utils/exchange_transfer_simulator.ts b/src/utils/exchange_transfer_simulator.ts index db12abd29..b85869351 100644 --- a/src/utils/exchange_transfer_simulator.ts +++ b/src/utils/exchange_transfer_simulator.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import {ExchangeContractErrs, TradeSide, TransferType} from '../types'; import {TokenWrapper} from '../contract_wrappers/token_wrapper'; diff --git a/src/utils/filter_utils.ts b/src/utils/filter_utils.ts index e09a95a6e..49dba0ed2 100644 --- a/src/utils/filter_utils.ts +++ b/src/utils/filter_utils.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import * as Web3 from 'web3'; import * as uuid from 'uuid/v4'; import * as ethUtil from 'ethereumjs-util'; diff --git a/src/utils/interval_utils.ts b/src/utils/interval_utils.ts index 62b79f2f5..66451800f 100644 --- a/src/utils/interval_utils.ts +++ b/src/utils/interval_utils.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; export const intervalUtils = { setAsyncExcludingInterval(fn: () => Promise<void>, intervalMs: number) { diff --git a/src/utils/lodash.ts b/src/utils/lodash.ts new file mode 100644 index 000000000..67e4e5a9a --- /dev/null +++ b/src/utils/lodash.ts @@ -0,0 +1,55 @@ +import assign from 'lodash-es/assign'; +import map from 'lodash-es/map'; +import values from 'lodash-es/values'; +import isUndefined from 'lodash-es/isUndefined'; +import isNull from 'lodash-es/isNull'; +import includes from 'lodash-es/includes'; +import each from 'lodash-es/each'; +import forEach from 'lodash-es/forEach'; +import filter from 'lodash-es/filter'; +import startsWith from 'lodash-es/startsWith'; +import padStart from 'lodash-es/padStart'; +import find from 'lodash-es/find'; +import zipWith from 'lodash-es/zipWith'; +import every from 'lodash-es/every'; +import isEmpty from 'lodash-es/isEmpty'; +import unzip from 'lodash-es/unzip'; +import pull from 'lodash-es/pull'; +import keys from 'lodash-es/keys'; +import uniq from 'lodash-es/uniq'; +import isArray from 'lodash-es/isArray'; +import isObject from 'lodash-es/isObject'; +import isString from 'lodash-es/isString'; +import isFinite from 'lodash-es/isFinite'; +import isNumber from 'lodash-es/isNumber'; +import isBoolean from 'lodash-es/isBoolean'; +import isFunction from 'lodash-es/isFunction'; + +export const _ = { + assign, + map, + values, + isUndefined, + isNull, + includes, + each, + forEach, + filter, + startsWith, + padStart, + find, + zipWith, + every, + isEmpty, + unzip, + pull, + keys, + uniq, + isArray, + isObject, + isString, + isFinite, + isNumber, + isBoolean, + isFunction, +}; diff --git a/src/utils/order_validation_utils.ts b/src/utils/order_validation_utils.ts index 1d9aac884..12a24cdea 100644 --- a/src/utils/order_validation_utils.ts +++ b/src/utils/order_validation_utils.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import {ExchangeContractErrs, SignedOrder, Order, ZeroExError, TradeSide, TransferType} from '../types'; import {ZeroEx} from '../0x'; import {TokenWrapper} from '../contract_wrappers/token_wrapper'; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index f2bf74860..2a02c448b 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../utils/lodash'; import * as ethABI from 'ethereumjs-abi'; import * as ethUtil from 'ethereumjs-util'; import {Order, SignedOrder, SolidityTypes} from '../types'; diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts index ff5d25d9c..521e20631 100644 --- a/src/web3_wrapper.ts +++ b/src/web3_wrapper.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from './utils/lodash'; import * as Web3 from 'web3'; import * as BigNumber from 'bignumber.js'; import promisify = require('es6-promisify'); diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index dd5dd19b1..0c1d1a68d 100644 --- a/test/0x.js_test.ts +++ b/test/0x.js_test.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../src/utils/lodash'; import * as chai from 'chai'; import {chaiSetup} from './utils/chai_setup'; import 'mocha'; diff --git a/test/token_registry_wrapper_test.ts b/test/token_registry_wrapper_test.ts index 6b5dd517e..b415ec1c6 100644 --- a/test/token_registry_wrapper_test.ts +++ b/test/token_registry_wrapper_test.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../src/utils/lodash'; import 'mocha'; import * as chai from 'chai'; import {SchemaValidator, schemas} from '0x-json-schemas'; diff --git a/test/utils/order_factory.ts b/test/utils/order_factory.ts index fc4adebd9..30a6f376a 100644 --- a/test/utils/order_factory.ts +++ b/test/utils/order_factory.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../../src/utils/lodash'; import * as BigNumber from 'bignumber.js'; import {ZeroEx, SignedOrder} from '../../src'; diff --git a/test/utils/token_utils.ts b/test/utils/token_utils.ts index 51cb9411c..ab0682b32 100644 --- a/test/utils/token_utils.ts +++ b/test/utils/token_utils.ts @@ -1,4 +1,4 @@ -import * as _ from 'lodash'; +import {_} from '../../src/utils/lodash'; import {Token, InternalZeroExError} from '../../src/types'; const PROTOCOL_TOKEN_SYMBOL = 'ZRX'; diff --git a/webpack.config.js b/webpack.config.js index 61a7e4196..caf45d31b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,7 +1,6 @@ /** * This is to generate the umd bundle only */ -const _ = require('lodash'); const webpack = require('webpack'); const path = require('path'); const production = process.env.NODE_ENV === 'production'; @@ -10,7 +9,7 @@ let entry = { 'index': './src/index.ts', }; if (production) { - entry = _.assign({}, entry, {'index.min': './src/index.ts'}); + entry = Object.assign({}, entry, {'index.min': './src/index.ts'}); } module.exports = { @@ -2,9 +2,9 @@ # yarn lockfile v1 -"0x-json-schemas@^0.6.1": - version "0.6.1" - resolved "https://registry.yarnpkg.com/0x-json-schemas/-/0x-json-schemas-0.6.1.tgz#ff1b09542422dd9292dd7618a7c5c21d41c99cbf" +"0x-json-schemas@^0.6.3": + version "0.6.3" + resolved "https://registry.yarnpkg.com/0x-json-schemas/-/0x-json-schemas-0.6.3.tgz#976175de4b07f4597f97658b3c56720530eee282" dependencies: jsonschema "^1.2.0" @@ -12,19 +12,19 @@ version "4.0.2" resolved "https://registry.yarnpkg.com/@types/bignumber.js/-/bignumber.js-4.0.2.tgz#22a16946c9faa9f2c9c0ad4c7c3734a3033320ae" -"@types/fs-extra@^4.0.0": +"@types/fs-extra@4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.0.tgz#1dd742ad5c9bce308f7a52d02ebc01421bc9102f" dependencies: "@types/node" "*" -"@types/handlebars@^4.0.31": - version "4.0.33" - resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.33.tgz#ee45696b067e4bdf15c3956710a4c36c17d8f8f0" +"@types/handlebars@4.0.31": + version "4.0.31" + resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.31.tgz#a7fba66fafe42713aee88eeca8db91192efe6e72" -"@types/highlight.js@^9.1.8": - version "9.1.9" - resolved "https://registry.yarnpkg.com/@types/highlight.js/-/highlight.js-9.1.9.tgz#ed6336955eaf233b75eb7923b9b1f373d045ef01" +"@types/highlight.js@9.1.8": + version "9.1.8" + resolved "https://registry.yarnpkg.com/@types/highlight.js/-/highlight.js-9.1.8.tgz#d227f18bcb8f3f187e16965f2444859a04689758" "@types/jsonschema@^1.1.1": version "1.1.1" @@ -32,15 +32,25 @@ dependencies: jsonschema "*" -"@types/lodash@^4.14.37", "@types/lodash@^4.14.64": - version "4.14.68" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.68.tgz#754fbab68bd2bbb69547dc8ce7574f7012eed7f6" +"@types/lodash-es@^4.14.7": + version "4.14.7" + resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.14.7.tgz#5eac6eff541ff352e5c818be326588230616c8f1" + dependencies: + "@types/lodash" "*" + +"@types/lodash@*", "@types/lodash@4.14.74": + version "4.14.74" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.74.tgz#ac3bd8db988e7f7038e5d22bd76a7ba13f876168" + +"@types/lodash@^4.14.77": + version "4.14.77" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.77.tgz#0bc699413e84d6ed5d927ca30ea0f0a890b42d75" -"@types/marked@0.0.28": - version "0.0.28" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.0.28.tgz#44ba754e9fa51432583e8eb30a7c4dd249b52faa" +"@types/marked@0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.3.0.tgz#583c223dd33385a1dda01aaf77b0cd0411c4b524" -"@types/minimatch@^2.0.29": +"@types/minimatch@2.0.29": version "2.0.29" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a" @@ -52,9 +62,9 @@ version "8.0.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.9.tgz#19f44c3b6cb8a70d261d366f73650e3e3891ab2d" -"@types/shelljs@^0.7.0": - version "0.7.2" - resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.2.tgz#c2bdb3fe80cd7a3da08750ca898ae44c589671f3" +"@types/shelljs@0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.0.tgz#229c157c6bc1e67d6b990e6c5e18dbd2ff58cff0" dependencies: "@types/node" "*" @@ -1688,9 +1698,9 @@ ethereumjs-block@^1.2.2: ethereumjs-util "^5.0.0" merkle-patricia-tree "^2.1.2" -ethereumjs-blockstream@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/ethereumjs-blockstream/-/ethereumjs-blockstream-2.0.6.tgz#12c37ad5ac138d1d0abd60e7f4fa4344739f7e8b" +ethereumjs-blockstream@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/ethereumjs-blockstream/-/ethereumjs-blockstream-2.0.7.tgz#8e791d18d517f13e0ba928892dda545dc930936b" dependencies: immutable "3.8.1" source-map-support "0.4.14" @@ -2864,6 +2874,10 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" +lodash-es@4.14.7: + version "4.14.2" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.14.2.tgz#6a724b14f743dab068c1031d4d3d34fff8aa9ee0" + lodash.assign@^4.0.3, lodash.assign@^4.0.6: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" @@ -4728,17 +4742,17 @@ typedoc-default-themes@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.5.0.tgz#6dc2433e78ed8bea8e887a3acde2f31785bd6227" -typedoc@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.8.0.tgz#d7172bc6a29964f451b7609c005beadadefe2361" - dependencies: - "@types/fs-extra" "^4.0.0" - "@types/handlebars" "^4.0.31" - "@types/highlight.js" "^9.1.8" - "@types/lodash" "^4.14.37" - "@types/marked" "0.0.28" - "@types/minimatch" "^2.0.29" - "@types/shelljs" "^0.7.0" +typedoc@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.9.0.tgz#159bff7c7784ce5b91d86f3e4cc8928e62040957" + dependencies: + "@types/fs-extra" "4.0.0" + "@types/handlebars" "4.0.31" + "@types/highlight.js" "9.1.8" + "@types/lodash" "4.14.74" + "@types/marked" "0.3.0" + "@types/minimatch" "2.0.29" + "@types/shelljs" "0.7.0" fs-extra "^4.0.0" handlebars "^4.0.6" highlight.js "^9.0.0" |