πΉ Sharyn β A collection of JavaScript / TypeScript packages that make your life easier and reduce your boilerplate code
MIT License
Sharyn is a collection of JavaScript / TypeScript packages that make your life easier and reduce your boilerplate code.
Note: I have ported the most useful of those packages over to my new repository V1V2.
@sharyn/util β Lodash-like utils:
true
if not null
or undefined
if
, else if
, else if
... else
utilthrow
in an expressionswitch
try
- catch
- finally
Promise
-based delay@sharyn/scripts β Helpers to write "NPM scripts" in a JavaScript file
@sharyn/tags β No-op ES6 template string tags to enable syntax highlighting in editors:
@sharyn/nanoid β A Nano ID default configuration
@sharyn/actions β Flux Standard Actions creator functions
@sharyn/chakra-next β Next Link applied to Chakra UI components
@sharyn/react-hooks β React Hooks:
@sharyn/react-router β Components for React Router:
Route
that redirects unauthenticated usersRoute
that refreshes the page on the client@sharyn/browser β Helpers for code that runs in the browser:
Depending on your needs, you can install individual modules, like @sharyn/util.swit, a group of modules, like @sharyn/util, or the whole library. If you want to install everything, run:
npm i sharyn && npm i --save-dev sharyn-dev
# or
yarn add sharyn && yarn add --dev sharyn-dev
This will install sharyn in your dependencies
and sharyn-dev in your devDependencies
.
If you use sharyn/react-hooks
or sharyn/react-router
which are included, you will need to install react
and react-router
too. They are not listed as peerDependencies
to avoid noise in projects that want to use sharyn
without React.
And depending on what packages you chose to install, you have different ways to import
or require
a module:
// If you installed an individual package (all lowercase)
import swit from '@sharyn/util.swit'
// If you installed a group of modules like '@sharyn/util'
import swit from '@sharyn/util/swit'
import { swit } from '@sharyn/util'
// If you installed the whole 'sharyn' library
import swit from 'sharyn/util/swit'
import { swit } from 'sharyn/util'
Note: TypeScript users, you need your esModuleInterop
set to true
if you want to import the default exports without having to use the *
syntax.
By Jonathan Verrecchia (verekia) Github β’ Twitter β’ Website β MIT License
Sharyn is a reference to one of my favorite metalcore songs, Rose of Sharyn by Killswitch Engage.
Rose illustration by tiaesther_4360