@smart-erp/libs
v1.0.2
Published
@smart-erp/libs is a collection of utility functions and classes designed to simplify common tasks in web development. It includes modules for formatting dates, currency values, and more.
Downloads
3
Readme
About @smart-erp/libs
📚
@smart-erp/libs
is a collection of utility functions and classes designed to simplify common tasks in web development. It includes modules for formatting dates, currency values, and more.
Installation
Install the package using npm:
npm install @smart-erp/libs --save
Via Git:
git clone https://github.com/turbotechlabs/node-libs.git
Usage
Format Class
The Format
class provides date formatting functionality. Read more
import { Format } from '@smart-erp/libs';
const dateString = '2023-05-15';
const formattedDate = Format.date(dateString);
console.log(formattedDate); // Output: May 15, 2023
Currency Class
The Currency
class offers methods for formatting currency values. Read more
import { Currency } from '@smart-erp/libs';
console.log(Currency.format(123.456)); // Output: "123.46"
console.log(Currency.formatWithComma(1234567.89)); // Output: "1,234,567.89"
Merge Class
The Merge
class is used to merge objects with URL search parameters. Read more
import { Merge } from '@smart-erp/libs';
const options = { a: '1', b: '2' };
const searchParams = new URLSearchParams('b=3&c=4');
const result = Merge.object(options, searchParams);
console.log(result); // Output: { a: '1', b: '3', c: '4' }
Thumbnail Class
The Thumbnail
class generates HTML for thumbnail images. Read more
import { Thumbnail } from '@smart-erp/libs';
const thumbnailHtml = Thumbnail.list({
url: 'https://example.com/image.jpg',
alt: 'Example image'
});
console.log(thumbnailHtml);