bitcore-lib-cash
Advanced tools
Comparing version 8.25.28 to 8.25.30
@@ -136,10 +136,2 @@ 'use strict'; | ||
function unindexNetworkBy(network, values) { | ||
for(var index = 0; index < values.length; index++){ | ||
var value = values[index]; | ||
if(networkMaps[value] === network) { | ||
delete networkMaps[value]; | ||
} | ||
} | ||
} | ||
@@ -153,2 +145,5 @@ /** | ||
function removeNetwork(network) { | ||
if (typeof network !== 'object') { | ||
network = get(network); | ||
} | ||
for (var i = 0; i < networks.length; i++) { | ||
@@ -159,3 +154,15 @@ if (networks[i] === network) { | ||
} | ||
unindexNetworkBy(network, Object.keys(networkMaps)); | ||
for (var key in networkMaps) { | ||
if (networkMaps[key].length) { | ||
const index = networkMaps[key].indexOf(network); | ||
if (index >= 0) { | ||
networkMaps[key].splice(index, 1); | ||
} | ||
if (networkMaps[key].length === 0) { | ||
delete networkMaps[key]; | ||
} | ||
} else if (networkMaps[key] === network) { | ||
delete networkMaps[key]; | ||
} | ||
} | ||
} | ||
@@ -162,0 +169,0 @@ |
{ | ||
"name": "bitcore-lib-cash", | ||
"version": "8.25.28", | ||
"version": "8.25.30", | ||
"description": "A pure and powerful JavaScript Bitcoin Cash library.", | ||
@@ -38,3 +38,3 @@ "author": "BitPay <dev@bitpay.com>", | ||
"dependencies": { | ||
"bitcore-lib": "^8.25.28", | ||
"bitcore-lib": "^8.25.30", | ||
"bn.js": "=4.11.8", | ||
@@ -56,3 +56,3 @@ "bs58": "^4.0.1", | ||
"license": "MIT", | ||
"gitHead": "713d540373cd442327f7fed479c2b69dfd239ab7" | ||
"gitHead": "b1848c67d201a06bb9f306040b2520dc8b35356b" | ||
} |
@@ -78,5 +78,12 @@ 'use strict'; | ||
somenet.name.should.equal('somenet'); | ||
networks.remove(somenet); | ||
}); | ||
it('can remove a custom network by name', function() { | ||
var net = networks.get('somenet'); | ||
should.exist(net); | ||
networks.remove('somenet'); | ||
var net = networks.get('somenet'); | ||
should.equal(net, undefined); | ||
}); | ||
var constants = ['name', 'alias', 'pubkeyhash', 'scripthash', 'xpubkey', 'xprivkey']; | ||
@@ -83,0 +90,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2578315
33583
Updatedbitcore-lib@^8.25.30