@polkadot/util
Advanced tools
Comparing version 9.4.2-7 to 9.4.2-8
// Copyright 2017-2022 @polkadot/util authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { assert } from "../assert.js"; | ||
import { createCmp } from "./helpers.js"; | ||
/** @internal */ | ||
@@ -15,19 +15,2 @@ | ||
} | ||
/** @internal */ | ||
function createCmp(cmp) { | ||
return (...items) => { | ||
assert(items.length >= 1, 'Must provide one or more bigint arguments'); | ||
let result = items[0]; | ||
for (let i = 1; i < items.length; i++) { | ||
if (cmp(items[i], result)) { | ||
result = items[i]; | ||
} | ||
} | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -34,0 +17,0 @@ * @name nMax |
@@ -0,1 +1,2 @@ | ||
/// <reference types="bn.js" /> | ||
import { BN } from './bn'; | ||
@@ -2,0 +3,0 @@ /** |
// Copyright 2017-2022 @polkadot/util authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { assert } from "../assert.js"; | ||
import { BN } from "./bn.js"; | ||
import { createCmp } from "../bi/helpers.js"; | ||
/** @internal */ | ||
function gt(a, b) { | ||
return a.gt(b); | ||
} | ||
/** @internal */ | ||
function createCmp(cmp) { | ||
return (...items) => { | ||
assert(items.length >= 1, 'Must provide one or more BN arguments'); | ||
let result = items[0]; | ||
for (let i = 1; i < items.length; i++) { | ||
result = cmp(result, items[i]); | ||
} | ||
return result; | ||
}; | ||
function lt(a, b) { | ||
return a.lt(b); | ||
} | ||
@@ -34,3 +30,3 @@ /** | ||
export const bnMax = createCmp(BN.max); | ||
export const bnMax = createCmp(gt); | ||
/** | ||
@@ -50,2 +46,2 @@ * @name bnMin | ||
export const bnMin = createCmp(BN.min); | ||
export const bnMin = createCmp(lt); |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _assert = require("../assert"); | ||
var _helpers = require("./helpers"); | ||
@@ -24,23 +24,2 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
} | ||
/** @internal */ | ||
function createCmp(cmp) { | ||
return function () { | ||
for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) { | ||
items[_key] = arguments[_key]; | ||
} | ||
(0, _assert.assert)(items.length >= 1, 'Must provide one or more bigint arguments'); | ||
let result = items[0]; | ||
for (let i = 1; i < items.length; i++) { | ||
if (cmp(items[i], result)) { | ||
result = items[i]; | ||
} | ||
} | ||
return result; | ||
}; | ||
} | ||
/** | ||
@@ -52,3 +31,3 @@ * @name nMax | ||
const nMax = createCmp(gt); | ||
const nMax = (0, _helpers.createCmp)(gt); | ||
/** | ||
@@ -60,3 +39,3 @@ * @name nMin | ||
exports.nMax = nMax; | ||
const nMin = createCmp(lt); | ||
const nMin = (0, _helpers.createCmp)(lt); | ||
exports.nMin = nMin; |
@@ -8,6 +8,4 @@ "use strict"; | ||
var _assert = require("../assert"); | ||
var _helpers = require("../bi/helpers"); | ||
var _bn = require("./bn"); | ||
// Copyright 2017-2022 @polkadot/util authors & contributors | ||
@@ -17,13 +15,10 @@ // SPDX-License-Identifier: Apache-2.0 | ||
/** @internal */ | ||
function createCmp(cmp) { | ||
return function () { | ||
(0, _assert.assert)(arguments.length >= 1, 'Must provide one or more BN arguments'); | ||
let result = arguments.length <= 0 ? undefined : arguments[0]; | ||
function gt(a, b) { | ||
return a.gt(b); | ||
} | ||
/** @internal */ | ||
for (let i = 1; i < arguments.length; i++) { | ||
result = cmp(result, i < 0 || arguments.length <= i ? undefined : arguments[i]); | ||
} | ||
return result; | ||
}; | ||
function lt(a, b) { | ||
return a.lt(b); | ||
} | ||
@@ -45,3 +40,3 @@ /** | ||
const bnMax = createCmp(_bn.BN.max); | ||
const bnMax = (0, _helpers.createCmp)(gt); | ||
/** | ||
@@ -62,3 +57,3 @@ * @name bnMin | ||
exports.bnMax = bnMax; | ||
const bnMin = createCmp(_bn.BN.min); | ||
const bnMin = (0, _helpers.createCmp)(lt); | ||
exports.bnMin = bnMin; |
@@ -14,4 +14,4 @@ "use strict"; | ||
type: 'cjs', | ||
version: '9.4.2-7' | ||
version: '9.4.2-8' | ||
}; | ||
exports.packageInfo = packageInfo; |
@@ -23,3 +23,3 @@ { | ||
"type": "module", | ||
"version": "9.4.2-7", | ||
"version": "9.4.2-8", | ||
"main": "./cjs/index.js", | ||
@@ -86,2 +86,7 @@ "module": "./index.js", | ||
}, | ||
"./bi/helpers": { | ||
"types": "./bi/helpers.d.ts", | ||
"require": "./cjs/bi/helpers.js", | ||
"default": "./bi/helpers.js" | ||
}, | ||
"./bi/min": { | ||
@@ -699,6 +704,6 @@ "types": "./bi/min.d.ts", | ||
"@babel/runtime": "^7.18.3", | ||
"@polkadot/x-bigint": "9.4.2-7", | ||
"@polkadot/x-global": "9.4.2-7", | ||
"@polkadot/x-textdecoder": "9.4.2-7", | ||
"@polkadot/x-textencoder": "9.4.2-7", | ||
"@polkadot/x-bigint": "9.4.2-8", | ||
"@polkadot/x-global": "9.4.2-8", | ||
"@polkadot/x-textdecoder": "9.4.2-8", | ||
"@polkadot/x-textencoder": "9.4.2-8", | ||
"@types/bn.js": "^5.1.0", | ||
@@ -705,0 +710,0 @@ "bn.js": "^5.2.1", |
@@ -8,3 +8,3 @@ // Copyright 2017-2022 @polkadot/util authors & contributors | ||
type: 'esm', | ||
version: '9.4.2-7' | ||
version: '9.4.2-8' | ||
}; |
Sorry, the diff of this file is too big to display
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
398
506230
+ Added@polkadot/x-bigint@9.4.2-8(transitive)
+ Added@polkadot/x-global@9.4.2-8(transitive)
+ Added@polkadot/x-textdecoder@9.4.2-8(transitive)
+ Added@polkadot/x-textencoder@9.4.2-8(transitive)
- Removed@polkadot/x-bigint@9.4.2-7(transitive)
- Removed@polkadot/x-global@9.4.2-7(transitive)
- Removed@polkadot/x-textdecoder@9.4.2-7(transitive)
- Removed@polkadot/x-textencoder@9.4.2-7(transitive)
Updated@polkadot/x-bigint@9.4.2-8
Updated@polkadot/x-global@9.4.2-8