npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pderas/vue2-utilities

v1.4.1

Published

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

Downloads

31

Readme

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

| name | Parameter | Type | Description | Return | |--------------|----------------------------|-------------------------|----------------------------------------------------------------------------------|:-----------:| | createDate | timestamp | String | Creates a date object from a database timestamp and returns a date object in UTC | Date | | getParent | el identifier | HTMLElement String | Finds the closest parent element with the given identifier | HTMLElement | | getUrlParams | url | String | Converts the url parameters into an object | Object | | printView | html, timeout | String, Number | Create a print screen for the view given, default timeout is 500ms | N/A | | nl2br | str is_xhtml | String Boolean | Converts all newline characters in a string into 'br' tag | String | | redirectTo | url | String | Redirects the window to a new url (based off hostname url) | N/A | | safeActiveElement | doc | HTMLElement | Gets the active element safely from the doc | HTMLElement | | shadeColor | color percent | String Number | Takes a color and a percent and shades that color | String |

Required parameters are bolded

Prototypes

Date

| Name | Parameter | Type | Default |Description | Return | |----------------------|-----------------------------|:-------------------:|-------------------|-------------------------------------------------------------------------|:----------:| | addTimezoneOffset | | | | Modifies the date object by adding the timezone offset. | N/A | | format | format | String | 'M d Y' | Converts the date to a custom formatted string (month day, year @ time) | String | | getMinutesString | | | | Gets the minute string for a date. | String | | getHoursString | | | | Gets the hour string for a date. | String | | removeTimezoneOffset | | | | Modifies the date object by removing the timezone offset. | N/A | | subMinutes | date | Date | | Substracts the minutes of one date from another | Number | | ~~toFormattedString~~| ~~monthDisplay, showTime~~ | ~~String, Boolean~~ | ~~'short', true~~ | Depreciated. Please use the format prototype. | ~~String~~ |

Required parameters are bolded

Number

| Name | Parameter | Type | Default | Description | Return | |----------------|----------------|:-------:|---------|-------------------------------------------------|:------:| | precisionRound | precision | Number | 0 | Rounds a number to the specified precision | Number | | toCommaString | | | | Converts a number to a comma seperated string | String | | toDollarString | showDollarSign | Boolean | true | Converts a number to a dollar string | String |

Required parameters are bolded

String

| Name | Parameter | Type | Description | Return | |----------------|-----------|:------:|------------------------------------------------------|:------:| | capitalize | | | Capitalizes the first character | String | | capitalizeAll | delim | String | Capitalizes all characters (delim defaults to space) | String | | spacesToChar | char | String | Converts spaces to specified character | String | | stripSlashes | | | Removes slashes | String | | stripPeriods | | | Removes periods | String | | stripDashes | | | Removes dashes | String | | toAlphaNumeric | | | Coverts a string to alpha numeric | String |

Required parameters are bolded

License

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