rc-helper
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

RC Helper

npm version downloads license

Helper function in javascript

Installation

With Yarn:

yarn add rc-helper

With npm:

npm install --save rc-helper

General Helper

isObjectExistKeys

A function that checks if an object has at least one key.

Parameters

  • data (object): The object to check.

Returns

  • (boolean): Returns true if the object has at least one key, else false.

Example

const obj1 = { a: 1, b: 2 };
const obj2 = {};
const obj3 = null;

isObjectExistKeys(obj1); // true
isObjectExistKeys(obj2); // false
isObjectExistKeys(obj3); // false

String Helper

removeSpace

Removes all spaces in a given string.

Parameters

  • string: A string value to remove spaces.

Returns

  • Returns a string value without spaces.

Throws

  • Throws a TypeError if the input is not a string.

Example

const result = removeSpace(" hello  world ");
console.log(result); // "helloworld"

Package Sidebar

Install

npm i rc-helper

Weekly Downloads

100

Version

1.1.2

License

MIT

Unpacked Size

30.4 kB

Total Files

13

Last publish

Collaborators

  • redclouds