0.0.2 • Published 4 years ago

@nath-green/utils v0.0.2

Weekly downloads
-
License
-
Repository
github
Last release
4 years ago

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.uk

Parameters

An object of values

ParamTypeDefaultDescription
urlStringURL to be formatted
secureBooleanfalseTo prefix with https

isEmptyObject

Returns a boolean

import { isEmptyObject } from "@nath-green/utils";

const models = {};

const noModels = isEmptyObject(models);

// returns true
import { isEmptyObject } from "@nath-green/utils";

const models = { latest: "Mustang", fastest: "Polo" };

const hasModels = !isEmptyObject(models);

// returns true

Parameters

A single parameter

ParamTypeDefaultDescription
objObjectObject to be tested