1.1.0 • Published 4 years ago
@varandas/mood-sentences v1.1.0
mood-sentences
✨ Mood sentences
Get simple mood sentences.
About mood-sentences
This repository was built for the Let's build our first JavaScript npm package tutorial series, published on https://dev.to/iamvarandas/let-s-build-our-first-javascript-npm-package-268l
In this tutorial we build a simple JavaScript package that gets a few mood sentences from a json file. It's a simple package, but you'll learn a lot in the process 🤓.
We cover everything from the setup, coding, adding tests, configuring our CI and finally pushing the package into npm.
- Introduction https://dev.to/iamvarandas/let-s-build-our-first-javascript-npm-package-268l
- Project setup https://dev.to/iamvarandas/let-s-build-our-first-javascript-npm-package-initial-setup-4pml
- Writing code https://dev.to/iamvarandas/let-s-build-our-first-javascript-npm-package-writing-code-10m0
- Writing tests https://dev.to/iamvarandas/let-s-build-our-first-javascript-npm-package-writing-tests-1ana
- Publishing the package https://dev.to/iamvarandas/let-s-build-our-first-javascript-npm-package-continuous-integration-ebn
Usage
Installation
If you just want to try the package:
npm install --save @varandas/mood-sentences
or with yarn:
yarn add @varandas/mood-sentences
Usiwng the package
const Moods = require('@varandas/moods')
// Get all sentences
const all = Moods.all
// Get all sentences for a specific mood
const anger = Moods.anger
const excitement = Moods.excitement
const boredom = Moods.boredom
const happiness = Moods.happiness
// Get a random sentence for a mood
const randomHappinessSentence = Moods.getRandom(Moods.list.happiness)
1.1.0
4 years ago