1.0.20 • Published 6 years ago

intraactive-framework-utilityfunctions v1.0.20

Weekly downloads
275
License
MIT
Repository
-
Last release
6 years ago

IntraActive Framework - Utility functions

IntraActive Framework's "Utility functions" package is a collection af convenient js functions used for web development in Sharepoint Modern

Installation

$ npm install intraactive-framework-utilityfunctions

Import

import { UtilityFunctions } from 'intraactive-framework-utilityfunctions'

Usage

UtilityFunctions.getSiteCollectionUrl(): string

Returning a string value like "https://domain.sharepoint.com/sites/intranet"

UtilityFunctions.getSiteCollection(): string

Returning a string value like "intranet"

UtilityFunctions.getCurrentAbsoluteSiteUrl(): string

Returning a string value like "https://domain.sharepoint.com/sites/intranet/subsite/Pages/Home.aspx"

UtilityFunctions.getWebServerRelativeUrl(): string

Returning a string value like "/sites/intranet"

UtilityFunctions.getLayoutsPageUrl(libraryName: string): string

Eg. UtilityFunctions.getLayoutsPageUrl('sp.js') Returning a string value like "/sites/intranet/_layouts/15/sp.js"

UtilityFunctions.getAbsoluteDomainUrl(): string

Returning a string value like "https://domain.sharepoint.com"

UtilityFunctions.hexToRgb(hex: string): { r: number; b: number; g: number }

Returns the RGB value of a hex-color

UtilityFunctions.textColorBasedOnBackgroundColorDarkness(backgroundColor: string, lightReturnColor: string, darkReturnColor: string): string

Returns the light or dark color based om darkness of background color

UtilityFunctions.getRandomStringKey(): string

Returning a random string value

UtilityFunctions.getYouTubeThumbnailFromURL(url: string): string

Returning the thumpnail image of a valid YouTube URL

UtilityFunctions.getTime(date: Date): string

Returning the time as a string 'mm:ss'