Add /*#__PURE__*/ annotations (#1684)
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
"version": "10.1.15-1-x",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.1",
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@polkadot/x-bigint": "10.1.15-1-x",
|
||||
"@polkadot/x-global": "10.1.15-1-x",
|
||||
"@polkadot/x-textdecoder": "10.1.15-1-x",
|
||||
|
||||
@@ -7,10 +7,10 @@ import { createCmp } from './helpers';
|
||||
* @name nMax
|
||||
* @summary Finds and returns the highest value in an array of bigint.
|
||||
*/
|
||||
export const nMax = createCmp<bigint>((a, b) => a > b);
|
||||
export const nMax = /*#__PURE__*/ createCmp<bigint>((a, b) => a > b);
|
||||
|
||||
/**
|
||||
* @name nMin
|
||||
* @summary Finds and returns the lowest value in an array of bigint.
|
||||
*/
|
||||
export const nMin = createCmp<bigint>((a, b) => a < b);
|
||||
export const nMin = /*#__PURE__*/ createCmp<bigint>((a, b) => a < b);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { BN } from './bn';
|
||||
* bnMax([new BN(1), new BN(3), new BN(2)]).toString(); // => '3'
|
||||
* ```
|
||||
*/
|
||||
export const bnMax = createCmp<BN>((a, b) => a.gt(b));
|
||||
export const bnMax = /*#__PURE__*/ createCmp<BN>((a, b) => a.gt(b));
|
||||
|
||||
/**
|
||||
* @name bnMin
|
||||
@@ -32,4 +32,4 @@ export const bnMax = createCmp<BN>((a, b) => a.gt(b));
|
||||
* bnMin([new BN(1), new BN(3), new BN(2)]).toString(); // => '1'
|
||||
* ```
|
||||
*/
|
||||
export const bnMin = createCmp<BN>((a, b) => a.lt(b));
|
||||
export const bnMin = /*#__PURE__*/ createCmp<BN>((a, b) => a.lt(b));
|
||||
|
||||
@@ -16,8 +16,8 @@ interface Codec {
|
||||
toU8a: (isBare?: unknown) => Uint8Array;
|
||||
}
|
||||
|
||||
const checkCodec = isOnObject<Codec>('toHex', 'toU8a');
|
||||
const checkRegistry = isOnObject<Registry>('get');
|
||||
const checkCodec = /*#__PURE__*/ isOnObject<Codec>('toHex', 'toU8a');
|
||||
const checkRegistry = /*#__PURE__*/ isOnObject<Registry>('get');
|
||||
|
||||
export function isCodec <T extends Codec = Codec> (value?: unknown): value is T {
|
||||
return checkCodec(value) && checkRegistry(value.registry);
|
||||
|
||||
@@ -16,4 +16,4 @@ interface Compact<T> {
|
||||
* @name isCompact
|
||||
* @summary Tests for SCALE-Compact-like object instance.
|
||||
*/
|
||||
export const isCompact: <T> (value?: unknown) => value is Compact<T> = isOnObject('toBigInt', 'toBn', 'toNumber', 'unwrap');
|
||||
export const isCompact: <T> (value?: unknown) => value is Compact<T> = /*#__PURE__*/ isOnObject('toBigInt', 'toBn', 'toNumber', 'unwrap');
|
||||
|
||||
@@ -19,4 +19,4 @@ import { isOn } from './helpers';
|
||||
* console.log('isObservable', isObservable(...));
|
||||
* ```
|
||||
*/
|
||||
export const isObservable = isOn<Observable>('next');
|
||||
export const isObservable = /*#__PURE__*/ isOn<Observable>('next');
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
import { isOnObject } from './helpers';
|
||||
|
||||
export const isPromise = isOnObject<Promise<unknown>>('catch', 'then');
|
||||
export const isPromise = /*#__PURE__*/ isOnObject<Promise<unknown>>('catch', 'then');
|
||||
|
||||
@@ -5,4 +5,4 @@ import type { ToBigInt } from '../types';
|
||||
|
||||
import { isOn } from './helpers';
|
||||
|
||||
export const isToBigInt = isOn<ToBigInt>('toBigInt');
|
||||
export const isToBigInt = /*#__PURE__*/ isOn<ToBigInt>('toBigInt');
|
||||
|
||||
@@ -5,4 +5,4 @@ import type { ToBn } from '../types';
|
||||
|
||||
import { isOn } from './helpers';
|
||||
|
||||
export const isToBn = isOn<ToBn>('toBn');
|
||||
export const isToBn = /*#__PURE__*/ isOn<ToBn>('toBn');
|
||||
|
||||
@@ -65,7 +65,7 @@ function converter (format: (w: string, i: number) => string): (value: AnyString
|
||||
* @name stringCamelCase
|
||||
* @summary Convert a dash/dot/underscore/space separated Ascii string/String to camelCase
|
||||
*/
|
||||
export const stringCamelCase = converter((w, i) =>
|
||||
export const stringCamelCase = /*#__PURE__*/ converter((w, i) =>
|
||||
// lowercase for first letter/first word, else uppercase first, rest unchanged
|
||||
(i ? CC_TO_UP[w.charCodeAt(0)] : CC_TO_LO[w.charCodeAt(0)]) + w.slice(1)
|
||||
);
|
||||
@@ -74,7 +74,7 @@ export const stringCamelCase = converter((w, i) =>
|
||||
* @name stringPascalCase
|
||||
* @summary Convert a dash/dot/underscore/space separated Ascii string/String to PascalCase
|
||||
*/
|
||||
export const stringPascalCase = converter((w) =>
|
||||
export const stringPascalCase = /*#__PURE__*/ converter((w) =>
|
||||
// uppercase the first character, leave the rest unchanged
|
||||
CC_TO_UP[w.charCodeAt(0)] + w.slice(1)
|
||||
);
|
||||
|
||||
@@ -27,7 +27,7 @@ function converter (map: readonly string[]): (value?: AnyString | null) => strin
|
||||
* stringLowerFirst('ABC'); // => 'aBC'
|
||||
* ```
|
||||
*/
|
||||
export const stringLowerFirst = converter(CC_TO_LO);
|
||||
export const stringLowerFirst = /*#__PURE__*/ converter(CC_TO_LO);
|
||||
|
||||
/**
|
||||
* @name stringUpperFirst
|
||||
@@ -43,4 +43,4 @@ export const stringLowerFirst = converter(CC_TO_LO);
|
||||
* stringUpperFirst('abc'); // => 'Abc'
|
||||
* ```
|
||||
*/
|
||||
export const stringUpperFirst = converter(CC_TO_UP);
|
||||
export const stringUpperFirst = /*#__PURE__*/ converter(CC_TO_UP);
|
||||
|
||||
Reference in New Issue
Block a user