0.3.4 • Published 2 years ago

yourhelpers v0.3.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Your Helpers @deprecated (use ts-liba)

Installation

  npm i yourhelpers

Documentation

types

type Arr<T = any> = T[] | readonly T[]

Array

reverse

  reverse<A extends Arr>(arr: A)

reduce

  reduce<T, Acc>(arr: Arr<T>, initialValue: Acc, func: Func<[Acc, T, number], Acc>)

sum

  sum<T extends Arr<number>>(arr: T)

map

  map<T, R>(arr: Arr<T>, func: Func<[T, number, Arr<T>], R>)

join

  join<T extends Arr<Primitive>, S extends string = ''>(arr: T, separator = '' as S)

includes

  includes<T extends Arr, V>(arr: T, value: V)

merge

  merge<A extends Arr, B extends Arr>(arrA: A, arrB: B)

range

  range(from: number, to: number)

isArray

  isArray<T>(value: T)

combine

  combine<A, B, C extends number>(arrA: A[], arrB: B[], count = 1 as Number.Uint<C>)

first

  first<T extends Arr>(arr: T)

last

  last<T extends Arr>(arr: T)

byIndex

  byIndex<A extends Arr, I extends number>(arr: A, index: I)

indexOf

  indexOf<A extends Arr, T>(arr: A, item: T)

Number

abs

  abs(num: number)

Object

byKey

  byKey<O extends Record<string, any>, T extends string, K = Object.DotKey<O, T>>(obj: O, key: T)

keys

  keys<O extends object>(obj: O)

values

  values<O extends object>(obj: O)

entries

  entries<O extends object>(obj: O)

String

substring

  substring<S extends string, I extends number>(str: S, i: Number.Uint<I>)

contains

  contains(str: string, needle: string | string[])

pad

  pad<S extends string, Sub extends string, N extends number>(str: S, substr: Sub, count = 1 as Number.Uint<N>)

padStart

  padStart<S extends string, Sub extends string, N extends number>(str: S, substr: Sub, count = 1 as Number.Uint<N>)

padEnd

  padEnd<S extends string, Sub extends string, N extends number>(str: S, substr: Sub, count = 1 as Number.Uint<N>)

repeat

  repeat<S extends string, N extends number>(str: S, count: Number.Uint<N>)

charCount

  charCount<
    Str extends string,
    Obj extends object = { [K in String.Split<Str>[number]]: number },
    Char extends keyof Obj = keyof Obj,
    Return extends Obj | Obj[Char] = Exclude<keyof Obj, Char> extends never ? Obj : Obj[Char],
  >(str: Str, needle?: Char)

capitalize

  capitalize<T extends string>(str: T)

camelCase

  camelCase<S extends string, D extends string = ' '>(str: S, delimiter = ' ' as D)

split

  split<T extends string, D extends string = ''>(str: T, delimiter = '' as D)

utils

curry

  curry<Fn extends Func<any, any>>(func: Fn)
0.3.4

2 years ago

0.3.3

2 years ago

0.3.0

2 years ago

0.3.2

2 years ago

0.1.4

2 years ago

0.3.1

2 years ago

0.1.3

2 years ago

0.0.20

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.0.19

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.1

3 years ago