0.0.2 • Published 5 years ago
@nath-green/utils v0.0.2
utils
Collection of utils
formatUrlWithProtocol
Returns formatted url
import { formatUrlWithProtocol } from "@nath-green/utils";
const formattedUrl = formatUrlWithProtocol({
  url: "www.test.co.uk",
  secure: true,
});
// returns https://www.test.co.ukParameters
An object of values
| Param | Type | Default | Description | 
|---|---|---|---|
| url | String | URL to be formatted | |
| secure | Boolean | false | To prefix with https | 
isEmptyObject
Returns a boolean
import { isEmptyObject } from "@nath-green/utils";
const models = {};
const noModels = isEmptyObject(models);
// returns trueimport { isEmptyObject } from "@nath-green/utils";
const models = { latest: "Mustang", fastest: "Polo" };
const hasModels = !isEmptyObject(models);
// returns trueParameters
A single parameter
| Param | Type | Default | Description | 
|---|---|---|---|
| obj | Object | Object to be tested | 
0.0.2
5 years ago