├── .github ├── FUNDING.yml ├── labeler.yml ├── auto_assign.yml ├── workflows │ ├── labeler.yml │ └── tests.yml └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug.yml ├── __tests__ ├── getRandomLine.test.js ├── getRandomLineType.test.js ├── getLines.test.js ├── getLinesType.test.js └── index.spec.js ├── package.json ├── index.js ├── LICENSE ├── CONTRIBUTING.md ├── data ├── inspire.json └── data.json ├── CODE_OF_CONDUCT.md ├── .gitignore └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: ["https://buymeacoffee.com/anirudhpanda"] 4 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | #Add 'hacktoberfest' for any changes in data files of the project 2 | hacktoberfest: 3 | - data/* 4 | 5 | #Add 'data' label to anything changed within data folder 6 | data: 7 | - data/* 8 | -------------------------------------------------------------------------------- /.github/auto_assign.yml: -------------------------------------------------------------------------------- 1 | # Set to true to add reviewers to pull requests 2 | addReviewers: true 3 | # Set to true to add assignees to pull requests 4 | addAssignees: false 5 | # A list of reviewers to be added to pull requests (GitHub user name) 6 | reviewers: 7 | - AnirudhPanda 8 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | name: "Pull Request Labeler" 2 | on: 3 | - pull_request_target 4 | 5 | jobs: 6 | triage: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/labeler@v3 10 | with: 11 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 12 | -------------------------------------------------------------------------------- /__tests__/getRandomLine.test.js: -------------------------------------------------------------------------------- 1 | const testGetRandomLines = () => { 2 | const favline = require("../index.js"); 3 | 4 | var myLine = favline.getRandomLine(); 5 | 6 | console.log("*********************************"); 7 | console.log("WE ARE GRAMMAR_NAZIS\n"); 8 | console.log("*********************************"); 9 | 10 | console.log("A random line I love- " + myLine); 11 | }; 12 | 13 | exports.default = testGetRandomLines; 14 | -------------------------------------------------------------------------------- /__tests__/getRandomLineType.test.js: -------------------------------------------------------------------------------- 1 | const testGetRandomLinesType = (type) => { 2 | const favline = require("../index.js"); 3 | 4 | var myLine = favline.getRandomLine(type); 5 | 6 | console.log("*********************************"); 7 | console.log("WE ARE GRAMMAR_NAZIS\n"); 8 | console.log("*********************************"); 9 | 10 | console.log("A random line I love- " + myLine); 11 | }; 12 | 13 | exports.default = testGetRandomLinesType; 14 | -------------------------------------------------------------------------------- /__tests__/getLines.test.js: -------------------------------------------------------------------------------- 1 | const testGetLines = () => { 2 | const favline = require("../index.js"); 3 | 4 | var myLine = favline.getLines(); 5 | 6 | console.log("*********************************"); 7 | console.log("WE ARE GRAMMAR_NAZIS\n"); 8 | console.log("*********************************"); 9 | 10 | console.log("The lines I love- " + myLine.line); 11 | console.log("Written by - " + myLine.author); 12 | console.log("From the book - " + myLine.book); 13 | }; 14 | 15 | exports.default = testGetLines; 16 | -------------------------------------------------------------------------------- /__tests__/getLinesType.test.js: -------------------------------------------------------------------------------- 1 | const testGetLinesType = (type) => { 2 | const favline = require("../index.js"); 3 | 4 | var myLine = favline.getLines(type); 5 | 6 | console.log("*********************************"); 7 | console.log("WE ARE GRAMMAR_NAZIS\n"); 8 | console.log("*********************************"); 9 | 10 | console.log("The lines I love- " + myLine.line); 11 | console.log("Written by - " + myLine.author); 12 | console.log("From the book - " + myLine.book); 13 | }; 14 | 15 | exports.default = testGetLinesType; 16 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: CI Tests 2 | 3 | on: 4 | push: 5 | branches: [$default-branch] 6 | pull_request: 7 | branches: [$default-branch] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | strategy: 14 | matrix: 15 | node-version: [12.x, 14.x, 16.x] 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Use Node.js ${{ matrix.node-version }} 20 | uses: actions/setup-node@v2 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | cache: "npm" 24 | - run: npm ci 25 | - run: npm test 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: FEATURE 5 | labels: enhancement, hacktoberfest 6 | assignees: "" 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bookquotes", 3 | "version": "1.0.5", 4 | "description": "Collection of people's favorite quotes from books around the world", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "jest" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/Opentek-Org/bookquotes.git" 12 | }, 13 | "keywords": [ 14 | "literature", 15 | "books", 16 | "quotes", 17 | "aesthetic", 18 | "captions", 19 | "philosophy" 20 | ], 21 | "author": "Anirudh Panda", 22 | "license": "MIT", 23 | "bugs": { 24 | "url": "https://github.com/Opentek-Org/bookquotes/issues" 25 | }, 26 | "homepage": "https://github.com/Opentek-Org/bookquotes#readme", 27 | "devDependencies": { 28 | "jest": "^27.2.4" 29 | }, 30 | "jest": { 31 | "verbose": true, 32 | "testRegex": "/__tests__/index.spec.js" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /__tests__/index.spec.js: -------------------------------------------------------------------------------- 1 | require("jest"); 2 | 3 | const testGetLines = require("./getLines.test").default; 4 | const testGetLinesType = require("./getLinesType.test").default; 5 | const testGetRandomLines = require("./getRandomLine.test").default; 6 | const testGetRandomLinesType = require("./getRandomLineType.test").default; 7 | 8 | describe("testing all exposed functions", () => { 9 | test("getLines() function returns no error", () => { 10 | expect(() => { 11 | testGetLines(); 12 | }).not.toThrow(); 13 | }); 14 | 15 | test("getRandomLines() function returns no error", () => { 16 | expect(() => { 17 | testGetRandomLines(); 18 | }).not.toThrow(); 19 | }); 20 | 21 | test("getRandomLines() function returns no error", () => { 22 | expect(() => { 23 | testGetRandomLinesType("isp"); 24 | }).not.toThrow(); 25 | }); 26 | 27 | test("getLines() function returns no error", () => { 28 | expect(() => { 29 | testGetLinesType("isp"); 30 | }).not.toThrow(); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | let array = require("./data/data.json"); 2 | let inspireArray = require("./data/inspire.json"); 3 | 4 | let favline = {}; 5 | 6 | function randomInt(min, max) { 7 | return Math.floor(Math.random() * (max - min) + min); 8 | } 9 | 10 | module.exports.getRandomLine = function (type) { 11 | let index = randomInt(0, array.length); 12 | switch (type) { 13 | case "isp": 14 | index = randomInt(0, inspireArray.length); 15 | return inspireArray[index].quote; 16 | default: 17 | return array[index].line; 18 | } 19 | }; 20 | 21 | module.exports.getLines = function (type) { 22 | let index = randomInt(0, array.length); 23 | switch (type) { 24 | case "isp": 25 | index = randomInt(0, inspireArray.length); 26 | favline.quote = inspireArray[index].quote; 27 | favline.author = inspireArray[index].author; 28 | return favline; 29 | default: 30 | favline.line = array[index].line; 31 | favline.book = array[index].book; 32 | favline.author = array[index].author; 33 | return favline; 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Opentek 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: Report a bug found in the Bookquotes source code 3 | labels: ["bug"] 4 | body: 5 | - type: textarea 6 | id: description 7 | attributes: 8 | label: Description 9 | description: A brief description of the question or issue, also include what you tried and what didn't work 10 | validations: 11 | required: true 12 | - type: textarea 13 | id: screenshots 14 | attributes: 15 | label: Screenshots 16 | description: Please add screenshots if applicable (recommended) 17 | validations: 18 | required: false 19 | - type: textarea 20 | id: extrainfo 21 | attributes: 22 | label: Additional information 23 | description: Is there anything else we should know about this bug? 24 | validations: 25 | required: false 26 | - type: checkboxes 27 | id: terms 28 | attributes: 29 | label: Do you want to work on this issue? 30 | description: We are here to assist you 31 | options: 32 | - label: I want to work on this issue. 33 | required: false 34 | 35 | - type: markdown 36 | attributes: 37 | value: | 38 | You can also join the Discord community [here](https://discord.gg/9qyr4Mdc3Y) 39 | Feel free to check out other amazing repositories of the Opentek [here](https://github.com/Opentek-Org) 40 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## 🛠️ Contribute 2 | 3 | 0. Star this repository 4 | 1. Fork this repository 5 | 2. Clone your forked copy of the project. 6 | 7 | ```bash 8 | git clone https://github.com//bookquotes.git 9 | ``` 10 | 11 | 3. Change the working directory 12 | 13 | ```bash 14 | cd bookquotes 15 | ``` 16 | 17 | 4. Add a reference to the original repository. 18 | 19 | ``` 20 | git remote add upstream https://github.com/Opentek-Org/bookquotes 21 | ``` 22 | 23 | 5. Check the remotes for this repository. 24 | 25 | ``` 26 | git remote -v 27 | ``` 28 | 29 | 6. Always take a pull from the upstream repository to your main branch to keep it at par with the main project(updated repository). 30 | 31 | ``` 32 | git pull upstream main 33 | ``` 34 | 35 | 7. Create a new branch. 36 | 37 | ``` 38 | git checkout -b 39 | ``` 40 | 41 | 8. Perfom your desired changes to the code base. 42 | 43 | [![giphy.gif](https://i.postimg.cc/Fs75yYVT/giphy.gif)](https://postimg.cc/jL0FKd9f) 44 | 45 | 9. Track your changes 46 | 47 | ``` 48 | git add . 49 | ``` 50 | 51 | 10. Commit your changes . 52 | 53 | ``` 54 | git commit -m "Relevant message" 55 | ``` 56 | 57 | 11. Push the committed changes in your feature branch to your remote repo. 58 | 59 | ``` 60 | git push -u origin 61 | 62 | ``` 63 | 64 | 12. To create a pull request, click on compare and pull requests. Please ensure you compare your feature branch to the desired branch of the repo you are suppose to make a PR to. 65 | 66 | 13. Voila 🎉 You have made a PR to the **bookquotes** project. Sit back patiently and relax while the project maintainers review your PR. 67 | 68 | Please read our [`CODE OF CONDUCT`](CODE_OF_CONDUCT.md), and the process for submitting pull requests to us. 69 | -------------------------------------------------------------------------------- /data/inspire.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "quote": "The moment you doubt whether you can fly, you cease forever to be able to do it.", 4 | "author": "J.M. Barrie" 5 | }, 6 | { 7 | "quote": "Time you enjoy wasting is not wasted time.", 8 | "author": "Marthe Troly-Curtin" 9 | }, 10 | { 11 | "quote": "When you can’t find someone to follow, you have to find a way to lead by example.", 12 | "author": "Tahereh Mafi" 13 | }, 14 | { 15 | "quote": "When you start to love yourself for the first time, your scars start to look a lot more like beauty marks.", 16 | "author": "Jacob Tobia" 17 | }, 18 | { 19 | "line": "All we have to decide is what to do with the time that is given to us.", 20 | "book": "The Fellowship of the Ring", 21 | "author": "J.R.R Tolkien" 22 | }, 23 | { 24 | "line": "It is better to be hated for what you are than to be loved for what you are not.", 25 | "book": "Autumn Leaves", 26 | "author": "André Gide" 27 | }, 28 | { 29 | "line": "Who you are is defined by what you’re willing to struggle for.", 30 | "book": "The Subtle Art of Not Giving a F*ck", 31 | "author": "Mark Manson" 32 | }, 33 | { 34 | "line": "Freedom itself demands discomfort.", 35 | "book": "Everything is F*cked", 36 | "author": "Mark Manson" 37 | }, 38 | { 39 | "line": "Hoping for the best, prepared for the worst, and unsurprised by anything in between.", 40 | "book": "I Know Why the Caged Bird Sings", 41 | "author": "Maya Angelou" 42 | }, 43 | { 44 | "line": "Love doesn’t just sit there, like a stone, it has to be made, like bread; remade all the time, made new.", 45 | "book": "The Lathe of Heaven", 46 | "author": "Ursula K. Le Guin" 47 | }, 48 | { 49 | "line":"Be yourself and people will like you.", 50 | "book":"Diary of a Wimpy Kid", 51 | "author":"Jeff Kinney" 52 | }, 53 | { 54 | "line": "Hoping for the best,prepared for the worst, and unsurprised by anything in between.", 55 | "book": "I know Why the Caged Bird Sings", 56 | "author": "Maya Angelou" 57 | }, 58 | { 59 | "line": "We all require devotion to something more than ourselves for our lives to be endurable.", 60 | "book": "Being Mortal", 61 | "author": "Atul Gawande" 62 | }, 63 | { 64 | "line": "Just because your version of normal isn't the same as someone else's version doesn't mean that there's anything wrong with you.", 65 | "book": "The Terrible Thing That Happened to Barnaby Brocket", 66 | "author": "John Boyne" 67 | }, 68 | { 69 | "line": "You are your best thing.", 70 | "book": "Beloved ", 71 | "author": "Toni Morrison" 72 | } 73 | ] 74 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | - Using welcoming and inclusive language 18 | - Being respectful of differing viewpoints and experiences 19 | - Gracefully accepting constructive criticism 20 | - Focusing on what is best for the community 21 | - Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | - The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | - Trolling, insulting/derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at opentekorg@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/node 2 | 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=node 4 | 5 | ### Node 6 | 7 | # Logs 8 | 9 | logs 10 | _.log 11 | npm-debug.log_ 12 | yarn-debug.log* 13 | yarn-error.log* 14 | lerna-debug.log* 15 | .pnpm-debug.log* 16 | 17 | # Diagnostic reports (https://nodejs.org/api/report.html) 18 | 19 | report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json 20 | 21 | # Runtime data 22 | 23 | pids 24 | _.pid 25 | _.seed 26 | \*.pid.lock 27 | 28 | # Directory for instrumented libs generated by jscoverage/JSCover 29 | 30 | lib-cov 31 | 32 | # Coverage directory used by tools like istanbul 33 | 34 | coverage 35 | \*.lcov 36 | 37 | # nyc test coverage 38 | 39 | .nyc_output 40 | 41 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 42 | 43 | .grunt 44 | 45 | # Bower dependency directory (https://bower.io/) 46 | 47 | bower_components 48 | 49 | # node-waf configuration 50 | 51 | .lock-wscript 52 | 53 | # Compiled binary addons (https://nodejs.org/api/addons.html) 54 | 55 | build/Release 56 | 57 | # Dependency directories 58 | 59 | node_modules/ 60 | jspm_packages/ 61 | 62 | # Snowpack dependency directory (https://snowpack.dev/) 63 | 64 | web_modules/ 65 | 66 | # TypeScript cache 67 | 68 | \*.tsbuildinfo 69 | 70 | # Optional npm cache directory 71 | 72 | .npm 73 | 74 | # Optional eslint cache 75 | 76 | .eslintcache 77 | 78 | # Microbundle cache 79 | 80 | .rpt2_cache/ 81 | .rts2_cache_cjs/ 82 | .rts2_cache_es/ 83 | .rts2_cache_umd/ 84 | 85 | # Optional REPL history 86 | 87 | .node_repl_history 88 | 89 | # Output of 'npm pack' 90 | 91 | \*.tgz 92 | 93 | # Yarn Integrity file 94 | 95 | .yarn-integrity 96 | 97 | # dotenv environment variables file 98 | 99 | .env 100 | .env.test 101 | .env.production 102 | 103 | # parcel-bundler cache (https://parceljs.org/) 104 | 105 | .cache 106 | .parcel-cache 107 | 108 | # Next.js build output 109 | 110 | .next 111 | out 112 | 113 | # Nuxt.js build / generate output 114 | 115 | .nuxt 116 | dist 117 | 118 | # Gatsby files 119 | 120 | .cache/ 121 | 122 | # Comment in the public line in if your project uses Gatsby and not Next.js 123 | 124 | # https://nextjs.org/blog/next-9-1#public-directory-support 125 | 126 | # public 127 | 128 | # vuepress build output 129 | 130 | .vuepress/dist 131 | 132 | # Serverless directories 133 | 134 | .serverless/ 135 | 136 | # FuseBox cache 137 | 138 | .fusebox/ 139 | 140 | # DynamoDB Local files 141 | 142 | .dynamodb/ 143 | 144 | # TernJS port file 145 | 146 | .tern-port 147 | 148 | # Stores VSCode versions used for testing VSCode extensions 149 | 150 | .vscode-test 151 | 152 | # yarn v2 153 | 154 | .yarn/cache 155 | .yarn/unplugged 156 | .yarn/build-state.yml 157 | .yarn/install-state.gz 158 | .pnp.\* 159 | 160 | ### Node Patch 161 | 162 | # Serverless Webpack directories 163 | 164 | .webpack/ 165 | 166 | # End of https://www.toptal.com/developers/gitignore/api/node 167 | 168 | # Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode 169 | 170 | # Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode 171 | 172 | ### VisualStudioCode 173 | 174 | .vscode/_ 175 | !.vscode/settings.json 176 | !.vscode/tasks.json 177 | !.vscode/launch.json 178 | !.vscode/extensions.json 179 | _.code-workspace 180 | 181 | # Local History for Visual Studio Code 182 | 183 | .history/ 184 | 185 | ### VisualStudioCode Patch 186 | 187 | # Ignore all local history of files 188 | 189 | .history 190 | .ionide 191 | 192 | # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode 193 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![bookquotes](https://socialify.git.ci/Opentek-Org/bookquotes/image?description=1&font=Inter&forks=1&issues=1&language=1&owner=1&pattern=Charlie%20Brown&pulls=1&stargazers=1&theme=Dark) 2 | 3 | # bookquotes 4 | 5 | [![NPM VERSION](http://img.shields.io/npm/v/bookquotes.svg?style=flat&logo=npm)](https://www.npmjs.org/package/bookquotes) [![GitHub license](https://img.shields.io/github/license/Opentek-Org/bookquotes.svg?style=flat&logo=github)](https://github.com/Opentek-Org/bookquotes/blob/main/LICENSE) [![NPM MODULE](http://img.shields.io/badge/bookquotes-orange.svg?style=flat&logo=node.js)](https://github.com/Opentek-Org/bookquotes) [![npm collaborators](https://img.shields.io/npm/collaborators/bookquotes.svg?logo=npm)](https://www.npmjs.com/package/bookquotes) [![GitHub issues](https://img.shields.io/github/issues/Opentek-Org/bookquotes.svg?logo=github)](https://www.npmjs.com/package/bookquotes) [![npm downloads](https://img.shields.io/npm/dt/bookquotes.svg?style=flat-square)](https://www.npmjs.com/package/bookquotes) 6 | 7 | #### A simple [NPM](https://www.npmjs.com/package/bookquotes) Package which returns 8 | 9 | - random **Lines** from people's favorite book with names of the **author** as well as the **book** . It provides great and aesthetic quotes to display in your application. 10 | - random **inspirational quotes**. Get your daily quote and stay motivated! 11 | 12 | #### If you like to read books, literature and want to stay motivated and inspired, this [package](https://opentek-org.github.io/bookquotes/) is for you! 13 | 14 | [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Opentek-Org/bookquotes.svg?logo=github&style=social)](https://www.npmjs.com/package/bookquotes) [![npm](https://img.shields.io/npm/dy/bookquotes.svg?logo=npm&style=social)](https://www.npmjs.com/package/bookquotes) [![GitHub top language](https://img.shields.io/github/languages/top/Opentek-Org/bookquotes.svg?logo=javascript&logoColor=yellow&style=social)]() 15 | 16 | **Click [here](https://www.npmjs.com/package/bookquotes)** to view this package on **NPM** registry. Check the homepage **[here](https://opentek-org.github.io/bookquotes/)**. 17 | 18 | ## Getting started 19 | 20 | [![NPM](https://nodei.co/npm/bookquotes.png?compact=true)](https://nodei.co/npm/bookquotes/) 21 | 22 | ``` 23 | $ npm install --save bookquotes 24 | ``` 25 | 26 | ## Installation 27 | 28 | [![NPM INSTALL](http://img.shields.io/badge/npm-install-blue.svg?style=flat&logo=npm)](https://docs.npmjs.com/getting-started/installing-npm-packages-locally) [![NODE JS](http://img.shields.io/badge/Node-JS-teal.svg?style=flat&logo=node.js)](https://nodejs.org/en/) [![inspirational-quotes](http://img.shields.io/badge/npm-bookquotes-red.svg?style=flat&logo=npm)](https://www.npmjs.com/package/inspirational-quotes) 29 | 30 | This is a [Node.js](https://nodejs.org/en/) module available through the 31 | [npm registry](https://www.npmjs.com/). 32 | 33 | Before installing, [download and install Node.js](https://nodejs.org/en/download/). 34 | 35 | Installation is done using the 36 | **[`npm install`](https://docs.npmjs.com/getting-started/installing-npm-packages-locally)** command: 37 | 38 | ```bash 39 | $ npm install bookquotes 40 | ``` 41 | 42 | ## Usage 43 | 44 | [![usage](https://forthebadge.com/images/badges/ctrl-c-ctrl-v.svg)](https://github.com/Opentek-Org/bookquotes/) 45 | 46 | - **_getLines()_** method returns an object containing **_line_** , **_book_**, and **_author_**. 47 | 48 | ```js 49 | const Line = require("bookquotes"); 50 | console.log(Line.getLines()); // generates an object having a line, name of book and author. 51 | ``` 52 | 53 | Output: 54 | 55 | ``` 56 | { 57 | line: 'I had the epiphany that laughter was light, and light was laughter, and that this was the secret of the universe.', 58 | book: ' Donna Tartt', 59 | author: 'The Goldfinch' 60 | } 61 | ``` 62 | 63 | - **_getLines(*typeCode*)_** method returns an object containing **_quote_** and **_author_**. 64 | 65 | ```js 66 | const Line = require("bookquotes"); 67 | console.log(Line.getLines("isp")); // generates an object having a line, name of book and author. 68 | ``` 69 | 70 | - **_Type codes_** 71 | 72 | ``` 73 | 'isp' = inspire 74 | ``` 75 | 76 | Output: 77 | 78 | ``` 79 | { 80 | quote: 'When you start to love yourself for the first time, your scars start to look a lot more like beauty marks.', 81 | author: 'Jacob Tobia' 82 | } 83 | ``` 84 | 85 | - **_getRandomLine()_** method returns a random **aesthetic** line! 86 | 87 | ```js 88 | const Line = require("bookquotes"); 89 | console.log(Line.getRandomLine()); // generates a single aesthetic line 90 | ``` 91 | 92 | Output: 93 | 94 | ``` 95 | All we have to decide is what to do with the time that is given us. 96 | ``` 97 | 98 | - **_getRandomLine(*typeCode*)_** method returns a specific **type** random aesthetic line. 99 | 100 | ```js 101 | const Line = require("bookquotes"); 102 | console.log(Line.getRandomLine("isp")); 103 | ``` 104 | 105 | - **_Type codes_** 106 | 107 | ``` 108 | 'isp' = inspire 109 | ``` 110 | 111 | Output: 112 | 113 | ``` 114 | When you start to love yourself for the first time, your scars start to look a lot more like beauty marks. 115 | ``` 116 | 117 | ## Testing the package! 118 | 119 | [![forthebadge](https://forthebadge.com/images/badges/works-on-my-machine.svg)](https://forthebadge.com) 120 | 121 | All the tests are in [tests](https://github.com/Opentek-Org/bookquotes/tree/main/__tests__) folder. 122 | 123 | - Install Jest using 124 | 125 | ``` 126 | npm install --save-dev jest 127 | ``` 128 | 129 | - Run the tests using 130 | 131 | ``` 132 | npm test 133 | ``` 134 | 135 | ## Want to contribute? 136 | 137 | [![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/vinitshahdeo) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat&logo=github)](https://github.com/Opentek-Org/bookquotes/pulls) 138 | 139 | > Please check issues **[here](https://github.com/Opentek-Org/bookquotes/issues)**! 140 | 141 | **[Add Lines from your Favorite Books](https://github.com/Opentek-Org/bookquotes/issues/1)** (Recommended for beginners) 142 | 143 | ### Follow the JSON format and add your content(your favorite line from a book or an inspirational quote) in [data](https://github.com/Opentek-Org/bookquotes/tree/main/data) file. 144 | 145 | > Please check HOW TO CONTRIBUTE **[here](CONTRIBUTING.md)**! 146 | 147 | ## License 148 | 149 | [![GitHub license](https://img.shields.io/github/license/Opentek-Org/bookquotes.svg?style=social&logo=github)](https://github.com/Opentek-Org/bookquotes/blob/main/LICENSE) [![Twitter Follow](https://img.shields.io/twitter/follow/anirudhpandaaa.svg?style=social)](https://twitter.com/anirudhpandaaa) [![GitHub followers](https://img.shields.io/github/followers/AnirudhPanda.svg?label=Follow&style=social)](https://github.com/AnirudhPanda/) 150 | 151 | [![forthebadge](https://forthebadge.com/images/badges/built-by-developers.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/made-with-javascript.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/open-source.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/powered-by-coffee.svg)](https://forthebadge.com) 152 | 153 | Inspired by [this](https://github.com/vinitshahdeo/inspirational-quotes) project 154 | -------------------------------------------------------------------------------- /data/data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "line": "Home isn’t where you land; home is where you launch. You can’t pick your home any more than you can choose your family. In poker, you get five cards. Three of them you can swap out, but two are yours to keep: family and native land.", 4 | "book": "An American Marriage", 5 | "author": "Tayari Jones" 6 | }, 7 | { 8 | "line": "To choose doubt as a philosophy of life is akin to choosing immobility as a means of transportation.", 9 | "book": "Life of Pi", 10 | "author": "Yann Martel" 11 | }, 12 | { 13 | "line": "The gods grow jealous of too much contentment anywhere, and they show their displeasure all of a sudden.", 14 | "book": "Malgudi Days", 15 | "author": "R. K. Narayan" 16 | }, 17 | { 18 | "line": "I was within and without, simultaneously enchanted and repelled by the inexhaustible variety of life", 19 | "book": "The Great Gatsby", 20 | "author": "F Scott Fitzgerald" 21 | }, 22 | { 23 | "line": "So I'll do that, and I'll do my best and if my best isn't good enough, at least I will have done everything I could, everything that is in me. I don't have to try to be someone else, someone I could never be.", 24 | "book": "Abhorsen", 25 | "author": "Garth Nix" 26 | }, 27 | { 28 | "line": "A mind needs books like a sword needs a whetstone, if it is to keep its edge.", 29 | "book": "A Game of Thrones: A Song of Ice and Fire", 30 | "author": "George R. R. Martin" 31 | }, 32 | 33 | { 34 | "line": "Whatever our souls are made of, his and mine are the same.", 35 | "book": "After We Collided", 36 | "author": "Anna Todd" 37 | }, 38 | { 39 | "line": "For the two of us, home isn't a place. It is a person. And we are finally home.", 40 | "book": "Anna and the French Kiss", 41 | "author": "Stephanie Perkins" 42 | }, 43 | { 44 | "line": "It does not do to dwell on dreams and forget to live.", 45 | "book": "Harry Potter and the Sorcerer’s Stone", 46 | "author": "J.K. Rowling" 47 | }, 48 | { 49 | "line": "There is nothing either good or bad, but thinking makes it so.", 50 | "book": "Hamlet", 51 | "author": "William Shakespeare" 52 | }, 53 | { 54 | "line": "It moves at its own measured pace, for it has no reason to hurry. Tomorrow will come in its own good time.", 55 | "book": "The Sky is Falling", 56 | "author": "Sidney Sheldon" 57 | }, 58 | { 59 | "line": "Men go to far greater lengths to avoid what they fear than to obtain what they desire.", 60 | "book": "The Da Vinci Code", 61 | "author": "Dan Brown" 62 | }, 63 | { 64 | "line": "You do not have to struggle to reach God, but you do have to struggle to tear away the self-created veil that hides him from you", 65 | "book": "Autobiography of a Yogi", 66 | "author": "Paramahansa Yogananda" 67 | }, 68 | { 69 | "line": "Never forget what you are, for surely the world will not. Make it your strength. Then it can never be your weakness.", 70 | "book": "A Song of Ice and Fire", 71 | "author": "George R.R. Martin" 72 | }, 73 | { 74 | "line": "All we have to decide is what to do with the time that is given us.", 75 | "book": "The Fellowship of the Ring", 76 | "author": "J.R.R. Tolkein" 77 | }, 78 | { 79 | "line": "I declare after all there is no enjoyment like reading! How much sooner one tires of any thing than of a book! -- When I have a house of my own, I shall be miserable if I have not an excellent library.", 80 | "book": "Pride and Prejudice", 81 | "author": "Jane Austen" 82 | }, 83 | { 84 | "line": "Tomorrow I’ll think of some way to get him back. After all, tomorrow is another day.", 85 | "book": "Margaret Mitchell", 86 | "author": "Gone with the Wind" 87 | }, 88 | { 89 | "line": "Why, sometimes, I’ve believed as many as six impossible things before breakfast.", 90 | "book": "Lewis Carroll", 91 | "author": "Through the Looking-Glass" 92 | }, 93 | { 94 | "line": "Don’t ever tell anybody anything. If you do, you start missing everybody.", 95 | "book": "J. D. Salinger", 96 | "author": "The Catcher in the Rye" 97 | }, 98 | { 99 | "line": "It does not do to dwell on dreams and forget to live.", 100 | "book": "J.K. Rowling", 101 | "author": "Harry Potter and the Sorcerer’s Stone" 102 | }, 103 | { 104 | "line": "You pierce my soul. I am half agony. Half hope. Tell me not that I am too late, that such precious feelings are gone for ever.", 105 | "book": " Jane Austen", 106 | "author": "Persuasion" 107 | }, 108 | { 109 | "line": "I had the epiphany that laughter was light, and light was laughter, and that this was the secret of the universe.", 110 | "book": " Donna Tartt", 111 | "author": "The Goldfinch" 112 | }, 113 | { 114 | "line": "There are some things you learn best in calm, and some in storm.", 115 | "book": "Willa Cather", 116 | "author": "The Song of the Lark" 117 | }, 118 | { 119 | "line": "When you play the game of thrones you win or you die.", 120 | "book": " George R. R. Martin", 121 | "author": "A Game of Thrones" 122 | }, 123 | { 124 | "line": "The world breaks everyone, and afterward, many are strong at the broken places.", 125 | "book": "Ernest Hemingway", 126 | "author": "A Farewell to Arms" 127 | }, 128 | { 129 | "line": "From that time on, the world was hers for the reading. She would never be lonely again, never miss the lack of intimate friends. Books became her friends and there was one for every mood.", 130 | "book": "Betty Smith", 131 | "author": "A Tree Grows in Brooklyn" 132 | }, 133 | { 134 | "line": "Once upon a time there was a boy who loved a girl, and her laughter was a question he wanted to spend his whole life answering.", 135 | "book": "Nicole Krauss", 136 | "author": "The History of Love" 137 | }, 138 | { 139 | "line": "Anyone who ever gave you confidence, you owe them a lot.", 140 | "book": "Truman Capote", 141 | "author": "Breakfast at Tiffany’s" 142 | }, 143 | { 144 | "line": "Isn’t it nice to think that tomorrow is a new day with no mistakes in it yet?", 145 | "book": "L. M. Montgomery", 146 | "author": "Anne of Green Gables" 147 | }, 148 | { 149 | "line": "Call me Ishmael.", 150 | "book": " Herman Melville", 151 | "author": "Moby Dick" 152 | }, 153 | { 154 | "line": "The past is not dead. In fact, it’s not even past.", 155 | "book": "William Faulkner", 156 | "author": "Requiem for a Nun" 157 | }, 158 | { 159 | "line": "He has put a knife on the things that held us together and we have fallen apart.", 160 | "book": "Chinua Achebe", 161 | "author": "Things Fall Apart" 162 | }, 163 | { 164 | "line": "Brave doesn’t mean you’re not scared. It means you go on even though you’re scared.", 165 | "book": "The Hate U Give", 166 | "author": "Angie Thomas" 167 | }, 168 | { 169 | "line": "Great dreamers' dreams are never fulfilled, they are always transcended.", 170 | "book": "The Monk who sold his Ferrari", 171 | "author": "Alfred Lord Whitehead" 172 | }, 173 | { 174 | "line": "Stupidity is one of the two things we see most clearly in retrospect. The other is missed chances.", 175 | "book": "11/23/63", 176 | "author": "Stephen King" 177 | }, 178 | 179 | { 180 | "line": "Sometimes, you read a book and it fills you with this weird evangelical zeal, and you become convinced that the shattered world will never be put back together unless and until all living humans read the book.", 181 | "book": "The Fault in Our Stars", 182 | "author": "John Green" 183 | }, 184 | { 185 | "line": "If you don't understand, ask questions. If you're uncomfortable about asking questions, say you are uncomfortable about asking questions and then ask anyway.", 186 | "book": "Americanah", 187 | "author": "Ngozi Adichie" 188 | }, 189 | { 190 | "line": "Perhaps one did not want to be loved so much as to be understood.", 191 | "book": "1984", 192 | "author": "George Orwell" 193 | }, 194 | { 195 | "line": "The great thing about this life of ours is that you can be someone different to everybody.", 196 | "book": "All the Bright Places", 197 | "author": "Jennifer Niven" 198 | }, 199 | { 200 | "line": "The moment you doubt whether you can fly, you cease for ever to be able to do it.", 201 | "book": "Peter Pan", 202 | "author": "J.M. Barrie" 203 | }, 204 | { 205 | "line": "It matters not what someone is born, but what they grow to be.", 206 | "book": "Harry Potter and the Goblet of Fire", 207 | "author": "J.K. Rowling" 208 | }, 209 | { 210 | "line": "Whatever our souls are made of, his and mine are the same.", 211 | "book": "Wuthering Heights", 212 | "author": "Emily Bronte" 213 | }, 214 | { 215 | "line": "I am not afraid of storms, for I am learning how to sail my ship", 216 | "book": "Little Women", 217 | "author": "Louisa May Alcott" 218 | }, 219 | { 220 | "line": "There are years that ask questions and years that answer.", 221 | "book": "Their Eyes Were Watching God", 222 | "author": "Zora Neale Hurston" 223 | }, 224 | { 225 | "line": "There is some good in this world and it’s worth fighting for.", 226 | "book": "The Two Towers", 227 | "author": "J.R.R. Tolkien" 228 | }, 229 | { 230 | "line": "Real courage is when you know you’re licked before you begin, but you begin anyway and see it through no matter what.", 231 | "book": "To Kill a Mockingbird", 232 | "author": "Harper Lee" 233 | }, 234 | { 235 | "line": "Whatever our souls are made of, his and mine are the same.", 236 | "book": "Wuthering Heights", 237 | "author": "Emily Brontë" 238 | }, 239 | { 240 | "line": "It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to.", 241 | "book": "The Lord of the Rings", 242 | "author": "J.R.R. Tolkien" 243 | }, 244 | 245 | { 246 | "line": "Be yourself and people will like you.", 247 | "book": "Diary of a Wimpy Kid", 248 | "author": "Jeff Kinney" 249 | }, 250 | 251 | { 252 | "line": "The one thing that doesn’t abide by majority rule is a person’s conscience.", 253 | "book": "To Kill a Mockingbird", 254 | "author": "Ashley Ross" 255 | }, 256 | { 257 | "line": "Sitting around miserable all day won't make you any happier.", 258 | "book": "The Boy in the Striped Pyjamas", 259 | "author": "John Boyne" 260 | }, 261 | { 262 | "line": "We need never be ashamed of our tears.", 263 | "book": "Great Expectations", 264 | "author": "Charles Dickens" 265 | }, 266 | { 267 | "line": "I don't understand it any more than you do, but one thing I've learned is that you don't have to understand things for them to be.", 268 | "book": "A Wrinkle in Time", 269 | "author": "Madeleine L'Engle" 270 | }, 271 | { 272 | "line": "There is nothing sweeter in this sad world than the sound of someone you love calling your name.", 273 | "book": "The Tale of Despereaux", 274 | "author": "Kate DiCamillo" 275 | }, 276 | { 277 | "line": "It's the possibility of having a dream come true that makes life interesting.", 278 | "book": "The Alchemist", 279 | "author": "Paulo Coelho" 280 | } 281 | ] 282 | --------------------------------------------------------------------------------