Remove default exports (#755)
* Remove default exports * Cleanup tests * Exports in util * Single secp256k1 instance * Length check * format check * encoded lengths
This commit is contained in:
@@ -8,6 +8,6 @@ import camelcase from 'camelcase';
|
||||
* @summary Convert a dash/dot/underscore/space separated string/String to camelCase
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export default function stringCamelCase (value: string | String): string {
|
||||
export function stringCamelCase (value: string | String): string {
|
||||
return camelcase(value.toString());
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
* @summary Utility methods to convert to work with `string` values
|
||||
*/
|
||||
|
||||
export { default as stringCamelCase } from './camelCase';
|
||||
export { default as stringLowerFirst } from './lowerFirst';
|
||||
export { default as stringShorten } from './shorten';
|
||||
export { default as stringToHex } from './toHex';
|
||||
export { default as stringToU8a } from './toU8a';
|
||||
export { default as stringUpperFirst } from './upperFirst';
|
||||
export { stringCamelCase } from './camelCase';
|
||||
export { stringLowerFirst } from './lowerFirst';
|
||||
export { stringShorten } from './shorten';
|
||||
export { stringToHex } from './toHex';
|
||||
export { stringToU8a } from './toU8a';
|
||||
export { stringUpperFirst } from './upperFirst';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* ```
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export default function stringLowerFirst (value?: string | String | null): string {
|
||||
export function stringLowerFirst (value?: string | String | null): string {
|
||||
return value
|
||||
? value.charAt(0).toLowerCase() + value.slice(1)
|
||||
: '';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* ```
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export default function stringShorten (value: String | string, prefixLength = 6): string {
|
||||
export function stringShorten (value: String | string, prefixLength = 6): string {
|
||||
if (value.length <= 2 + 2 * prefixLength) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2020 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import u8aToHex from '../u8a/toHex';
|
||||
import stringToU8a from './toU8a';
|
||||
import { u8aToHex } from '../u8a/toHex';
|
||||
import { stringToU8a } from './toU8a';
|
||||
|
||||
/**
|
||||
* @name stringToHex
|
||||
@@ -19,7 +19,7 @@ import stringToU8a from './toU8a';
|
||||
* ```
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export default function stringToHex (value?: String | string): string {
|
||||
export function stringToHex (value?: String | string): string {
|
||||
return u8aToHex(
|
||||
stringToU8a(value)
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ const encoder = new TextEncoder();
|
||||
* ```
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export default function stringToU8a (value?: String | string): Uint8Array {
|
||||
export function stringToU8a (value?: String | string): Uint8Array {
|
||||
return value
|
||||
? encoder.encode(value.toString())
|
||||
: new Uint8Array();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* ```
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export default function stringUpperFirst (value?: String | string | null): string {
|
||||
export function stringUpperFirst (value?: String | string | null): string {
|
||||
return value
|
||||
? value.charAt(0).toUpperCase() + value.slice(1)
|
||||
: '';
|
||||
|
||||
Reference in New Issue
Block a user