0.4.1 • Published 5 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.jsfunctions. It's useful to leave calls tomomentin 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 anhttpsurl to an insecurehttpone.nameToSlug(:string): Convert a passed name object to a slug, eg.Techstars New York Acceleratortotechstars-new-york-accelerator.slugToName(:string): Convert a passed slug to a human-readable name, eg.techstars-new-york-acceleratortoTechstars 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
5 years ago