Socket
Book a DemoInstallSign in
Socket

@pderas/vue2-utilities

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pderas/vue2-utilities

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

1.4.1
latest
Source
npmnpm
Version published
Weekly downloads
24
1100%
Maintainers
2
Weekly downloads
 
Created
Source

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
identifier
HTMLElement
String
Finds 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_xhtml
String
Boolean
Converts 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
percent
String
Number
Takes 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.

Keywords

vue2

FAQs

Package last updated on 09 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.