1.0.18 • Published 5 years ago
cc-utils v1.0.18
Code Craft - Utils
INSTALLING
via npm
npm install cc-utils
from source
git clone https://bitbucket.org/FinoCodeLab/cc-utils.git
HOW IS IT USED?
const Utils = require('cc-utils');
Utils.capitalizeFirstLetter('hello');
// Or
const { handlePagination } = require('cc-utils');
const { skip, limit } = handlePagination({ page: 1, limit: 20 })
// mongo example (mongoose)
const itemList = Item.find({}).skip(skip).limit(limit);AVAILABLE METHODS
| Methods | Params | Return |
|---|---|---|
| convertConstantToArray | obj | Array |
| convertSpecificToObject | obj, id | Object |
| convertObjectToArray | obj | Array |
| listObjectToSimple | list, key | Array |
| strReplaceAll | str, replace, by | String |
| isBase64 | text | Boolean |
| setAsObject | data | Object |
| orderJson | obj | Object |
| randomString | length | String |
| capitalizeFirstLetter | string | String |
| generateId | length | Number Int |
| handlePagination | { page, limit} | Number Int |
| unique | array | Array |
| currency | Number, object | Number |
| parseCurrency | (Number/String), Object | Array |
Descriptions
generateId: @param length (Int):return a String as long as length paramhandlePagination: @param options Object { page: Int, limit: Int}: return an object with skip and limit properties. This is for mongo queries.unique: @param array Array | return and array with uniques values.currency: @params value: Number, options: Object | return formatted NumberparseCurrency: @params value: Number or String, options: Object | return formatted Number. Extension for format-currency
1.0.18
5 years ago
1.0.17
5 years ago
1.0.16
5 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.13
5 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.10
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago