1.1.0 • Published 1 year ago

@foxmon/ts-util v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

ts-utility

Simple util function package

npm i @foxmon/ts-util
import tu from "@foxmon/ts-util";

1. is

Type check util

isArray

isBoolean

isString

// true
console.log(tu.isArray([]));

2. array

Array util

each function like Array.forEach

The each function can be used to object or array

// each function

// Array version
const array: number[] = [1, 2, 3, 4];
tu.each(array, (num: number) => {
  console.log(num);
});

// Object version
const object = {
  A: "Data-A",
  B: "Data-B",
};
tu.each(object, (item: string, key: string) => {
  console.log(`Value ${item}`);
  console.log(`Key ${key}`);
});

3. object

Object util

Deep copy object

const obj = {
  a: {
    b: 1,
  },
  c: 2,
};

const co = tu.deepClone(obj);
1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago