0.4.1 • Published 4 years ago
@techstars/utils v0.4.1
@techstars/utils
A handy utilities collection to be used as-needed across the monorepo. Before adding a new abstraction for your code, it's a good idea to check here for what you need.
Code Coverage
Available Methods
momentLib
: Collection of commonmoment.js
functions. It's useful to leave calls tomoment
in this package, that way we only have to think about it as a dependency stemming from one location..today()
: Get today's date formatted using the monorepo's convention.format(:string || :object)
: Format a string or date object using our convention.daysLeft(:string || :object)
: Determine the days left before a passed date.isPast(:string)
: Determine if a date is in the past.isFuture(:string)
: Determine if a date is in the future.isNowOrPast(:string)
: Determine if a date is current or in the past.isNowOrFuture(:string)
: Determine if a date is current or in the future.daysAgo(:integer)
: Return the date from X days ago, where X is a valid integer.daysFromNow(:integer)
: Return the date X days from now, where X is a valid integer
.prefixHttp(:string)
: Convert anhttps
url to an insecurehttp
one.nameToSlug(:string)
: Convert a passed name object to a slug, eg.Techstars New York Accelerator
totechstars-new-york-accelerator
.slugToName(:string)
: Convert a passed slug to a human-readable name, eg.techstars-new-york-accelerator
toTechstars New York Accelerator
Adding new methods
Feel free to add new methods to the collection as you see fit. Make sure to namespace grouped methods to a single object, as in momentLib
. Please also add new methods to our specs at ../test
.
0.4.1
4 years ago