uwfoster-util

1.0.1 • Public • Published

uwfoster-util

This module contains utility functions that are common in UW Foster applications.

Install

npm install uwfoster-util --save

Use

import uwutil from 'uwsoster-util';

let outputString = uwutil.strFormat.padAndTruncate('A string goes here.', 50);

// outputstring = "A string goes here.                               "

strFormat

The strFormat functions are used to format data for output and return strings.

daysOfWeek

The days of week function takes a comma-separated string or an array of day objects ({ Name: "Monday" }) and returns a 7-character string representing the days passed in. Days not passed in are represented as spaces in their respective position. For example if "Monday, Wednesday, Friday" is passed in, " M W F " is returned.

padAndTrim

The pad and trim function ensures that the passed in string is returned with a specified length. The string is either padded with spaces or trimmed to length.

truncateOnLastComma

The truncate on last comma function takes a comma separated string and trims it at the last comma-separated item to ensure it is shorter than the specified length. The function also adds ellipsis to the end of the string to indicate the list has been truncated.

Authors

  • Kevin Coleman

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    0

Package Sidebar

Install

npm i uwfoster-util

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • kevintechie