Utils cho javascript
- Sử dụng
- const utils = require('@hoaphatnp/utils');
- const slug = utils.slug;
- ...
- array -> Xử lý mảng
- currency -> Xử lý số, tiền tệ
- number -> Thao tác số
- datetime -> Xử lý DateTime
- slug -> "Máy lạnh Panasonic 123/4" -> "may-lanh-panasonic-1234"
- truncate -> Bớt chuỗi
- image -> Resize image
- otp -> Generate and validate OTP
- noTryCatch => Không cần try/catch khi sử dụng async/await
- middlewares -> chứa các middleware tái sử dụng
- middlewares.uploadAndResizeImage -> middleware upload and resize hình ảnh