1.4.1 • Published 5 years ago

@pderas/vue2-utilities v1.4.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Vue Utilities

A vue.js utilities plugin

Installation

npm install --save @pderas/vue2-utilities

How to initialize Vue Utilities

Vue utilities is built as a vue plugin to allow for general purpose functions to be used throughout the application

import Utilities from "@pderas/vue2-utilities";

// or just Vue.use(Utilities);
Vue.use(Utilities, {
    extendDate: true,
    extendNumber: true,
    extendString: true
});

Usage

General usage: this.$utils.[FUNCTION_NAME]

// RedirectTo Example
this.$utils.redirectTo('/login')

Functions

nameParameterTypeDescriptionReturn
createDatetimestampStringCreates a date object from a database timestamp and returns a date object in UTCDate
getParentel identifierHTMLElement StringFinds the closest parent element with the given identifierHTMLElement
getUrlParamsurlStringConverts the url parameters into an objectObject
printViewhtml, timeoutString, NumberCreate a print screen for the view given, default timeout is 500msN/A
nl2brstr is_xhtmlString BooleanConverts all newline characters in a string into 'br' tagString
redirectTourlStringRedirects the window to a new url (based off hostname url)N/A
safeActiveElementdocHTMLElementGets the active element safely from the docHTMLElement
shadeColorcolor percentString NumberTakes a color and a percent and shades that colorString

Required parameters are bolded

Prototypes

Date

NameParameterTypeDefaultDescriptionReturn
addTimezoneOffsetModifies the date object by adding the timezone offset.N/A
formatformatString'M d Y'Converts the date to a custom formatted string (month day, year @ time)String
getMinutesStringGets the minute string for a date.String
getHoursStringGets the hour string for a date.String
removeTimezoneOffsetModifies the date object by removing the timezone offset.N/A
subMinutesdateDateSubstracts the minutes of one date from anotherNumber
toFormattedStringmonthDisplay, showTimeString, Boolean'short', trueDepreciated. Please use the format prototype.String

Required parameters are bolded

Number

NameParameterTypeDefaultDescriptionReturn
precisionRoundprecisionNumber0Rounds a number to the specified precisionNumber
toCommaStringConverts a number to a comma seperated stringString
toDollarStringshowDollarSignBooleantrueConverts a number to a dollar stringString

Required parameters are bolded

String

NameParameterTypeDescriptionReturn
capitalizeCapitalizes the first characterString
capitalizeAlldelimStringCapitalizes all characters (delim defaults to space)String
spacesToCharcharStringConverts spaces to specified characterString
stripSlashesRemoves slashesString
stripPeriodsRemoves periodsString
stripDashesRemoves dashesString
toAlphaNumericCoverts a string to alpha numericString

Required parameters are bolded

License

This project is covered under the MIT License. Feel free to use it wherever you like.

1.4.1

5 years ago

1.4.0

5 years ago

1.3.7

5 years ago

1.3.6

6 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago