Swap to using eslint (#435)
* WIP * ... and more * yet more... * and examples (more-or-less) fixed * Only problematic promisify left... * Last batch * rm config header * Update * Use Record * Bumps
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
|
||||
import { stringCamelCase } from '.';
|
||||
|
||||
describe('stringCamelCase', () => {
|
||||
it('works correctly', () => {
|
||||
describe('stringCamelCase', (): void => {
|
||||
it('works correctly', (): void => {
|
||||
expect(
|
||||
stringCamelCase('Snake_case')
|
||||
).toBe('snakeCase');
|
||||
|
||||
@@ -4,26 +4,26 @@
|
||||
|
||||
import { stringLowerFirst } from '.';
|
||||
|
||||
describe('stringLowerFirst', () => {
|
||||
it("lowers the first letter if it's a capital letter", () => {
|
||||
describe('stringLowerFirst', (): void => {
|
||||
it("lowers the first letter if it's a capital letter", (): void => {
|
||||
expect(
|
||||
stringLowerFirst('ABC')
|
||||
).toBe('aBC');
|
||||
});
|
||||
|
||||
it("lowers the first letter if it's a lowercase letter", () => {
|
||||
it("lowers the first letter if it's a lowercase letter", (): void => {
|
||||
expect(
|
||||
stringLowerFirst('abc')
|
||||
).toBe('abc');
|
||||
});
|
||||
|
||||
it('returns undefined as empty', () => {
|
||||
it('returns undefined as empty', (): void => {
|
||||
expect(
|
||||
stringLowerFirst()
|
||||
).toBe('');
|
||||
});
|
||||
|
||||
it('returns null as empty', () => {
|
||||
it('returns null as empty', (): void => {
|
||||
expect(
|
||||
stringLowerFirst(null)
|
||||
).toBe('');
|
||||
|
||||
@@ -4,26 +4,26 @@
|
||||
|
||||
import { stringShorten } from '.';
|
||||
|
||||
describe('stringShorten', () => {
|
||||
it('returns the value as-is when <= maxLength', () => {
|
||||
describe('stringShorten', (): void => {
|
||||
it('returns the value as-is when <= maxLength', (): void => {
|
||||
expect(
|
||||
stringShorten('0123456789', 4)
|
||||
).toEqual('0123456789');
|
||||
});
|
||||
|
||||
it('returns the shortened value when > maxLength', () => {
|
||||
it('returns the shortened value when > maxLength', (): void => {
|
||||
expect(
|
||||
stringShorten('0123456789', 3)
|
||||
).toEqual('012..789');
|
||||
});
|
||||
|
||||
it('returns undefined as undefined', () => {
|
||||
it('returns undefined as undefined', (): void => {
|
||||
expect(
|
||||
stringShorten()
|
||||
).toEqual('undefined');
|
||||
});
|
||||
|
||||
it('returns non-string values as strings', () => {
|
||||
it('returns non-string values as strings', (): void => {
|
||||
expect(
|
||||
stringShorten(12345678, 2)
|
||||
).toEqual('12..78');
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* stringShorten('1234567890', 2); // => 12..90
|
||||
* ```
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export default function stringShorten (_value?: any, prefixLength: number = 6): string {
|
||||
const value = `${_value}`;
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
import { stringToU8a } from '..';
|
||||
|
||||
describe('stringToU8a', () => {
|
||||
it('decodes to an empty string for undefined', () => {
|
||||
describe('stringToU8a', (): void => {
|
||||
it('decodes to an empty string for undefined', (): void => {
|
||||
expect(
|
||||
stringToU8a()
|
||||
).toEqual(new Uint8Array([]));
|
||||
});
|
||||
|
||||
it('encodes the string correctly', () => {
|
||||
it('encodes the string correctly', (): void => {
|
||||
expect(
|
||||
stringToU8a('Привет, мир!')
|
||||
).toEqual(
|
||||
|
||||
@@ -4,26 +4,26 @@
|
||||
|
||||
import { stringUpperFirst } from '.';
|
||||
|
||||
describe('stringUpperFirst', () => {
|
||||
it("uppers the first letter if it's a capital letter", () => {
|
||||
describe('stringUpperFirst', (): void => {
|
||||
it("uppers the first letter if it's a capital letter", (): void => {
|
||||
expect(
|
||||
stringUpperFirst('ABC')
|
||||
).toBe('ABC');
|
||||
});
|
||||
|
||||
it("uppers the first letter if it's a lowercase letter", () => {
|
||||
it("uppers the first letter if it's a lowercase letter", (): void => {
|
||||
expect(
|
||||
stringUpperFirst('abc')
|
||||
).toBe('Abc');
|
||||
});
|
||||
|
||||
it('returns undefined as empty', () => {
|
||||
it('returns undefined as empty', (): void => {
|
||||
expect(
|
||||
stringUpperFirst()
|
||||
).toBe('');
|
||||
});
|
||||
|
||||
it('returns null as empty', () => {
|
||||
it('returns null as empty', (): void => {
|
||||
expect(
|
||||
stringUpperFirst(null)
|
||||
).toBe('');
|
||||
|
||||
Reference in New Issue
Block a user