Skip to content

Commit

Permalink
Major refactorisation, added eslint inside dev dependencies and updat…
Browse files Browse the repository at this point in the history
…ed README.md
  • Loading branch information
Milutin-P committed Mar 13, 2022
1 parent f9e9b9f commit 79c6607
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 25 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [ "error", 2 ],
"linebreak-style": [ "error", "unix" ],
"semi": [ "error", "always" ]
},
"parserOptions": {
"ecmaVersion": 2017
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/
node_modules/
tmp/
package-lock.json
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
.eslintrc*
.eslintignore
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
# star trek ipsum
# star-trek-ipsum
![npm](https://img.shields.io/npm/dw/star-trek-ipsum) ![npm](https://img.shields.io/npm/v/star-trek-ipsum)



> Get a random quote from Star Trek series
## Install

### npm
```
$ npm install star-trek-ipsum
```

### yarn
```
$ yarn add star-trek-ipsum
```

## Usage

```js
import getStarTrekQuote from 'star-trek-ipsum';

getStarTrekQuote();
//=> 'We're acquainted with the wormhole phenomenon...'
```

## API

### uniqueString()

Returns a String which represents a Star Trek quote.
40 changes: 23 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
const STAR_TREK_LOREM_IPSUM_ARRAY = [
'Communication is not possible. The shuttle has no power. Using the gravitational pull of a star to slingshot back in time? \n We are going to Starbase Montgomery for Engineering consultations prompted by minor read-out anomalies. Probes have recorded unusual levels of geological activity in all five planetary systems. Assemble a team. Look at records of the Drema quadrant. Would these scans detect artificial transmissions as well as natural signals?',
'Sensors indicate no shuttle or other ships in this sector. According to coordinates, we have travelled 7,000 light years and are located near the system J-25. Tractor beam released, sir. Force field maintaining our hull integrity. Damage report? Sections 27, 28 and 29 on decks four, five and six destroyed. Without our shields, at this range it is probable a photon detonation could destroy the Enterprise.',
"We're acquainted with the wormhole phenomenon, but this... Is a remarkable piece of bio-electronic engineering by which I see much of the EM spectrum ranging from heat and infrared through radio waves, et cetera, and forgive me if I've said and listened to this a thousand times. This planet's interior heat provides an abundance of geothermal energy. We need to neutralize the homing signal.",
"Sensors indicate human life forms 30 meters below the planet's surface. Stellar flares are increasing in magnitude and frequency. Set course for Rhomboid Dronegar 006, warp seven. There's no evidence of an advanced communication network. Total guidance system failure, with less than 24 hours' reserve power. Shield effectiveness has been reduced 12 percent. We have covered the area in a spherical pattern which a ship without warp drive could cross in the given time.",
'Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.',
"It indicates a synchronic distortion in the areas emanating triolic waves. The cerebellum, the cerebral cortex, the brain stem, the entire nervous system has been depleted of electrochemical energy. Any device like that would produce high levels of triolic waves. These walls have undergone some kind of selective molecular polarization. I haven't determined if our phaser energy can generate a stable field. We could alter the photons with phase discriminators.",
"Run a manual sweep of anomalous airborne or electromagnetic readings. Radiation levels in our atmosphere have increased by 3,000 percent. Electromagnetic and subspace wave fronts approaching synchronization. What is the strength of the ship's deflector shields at maximum output? The wormhole's size and short period would make this a local phenomenon. Do you have sufficient data to compile a holographic simulation?",
];

module.exports = function getStarTrekQuote() {
const randomArrayElementNumber = Math.floor(
Math.random() * STAR_TREK_LOREM_IPSUM_ARRAY.length,
);
return STAR_TREK_LOREM_IPSUM_ARRAY[randomArrayElementNumber];
};

/*
Copyright (c) 2022 Milutin Pesikan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

module.exports = require('./lib/getStarTrekQuote');
26 changes: 26 additions & 0 deletions lib/getStarTrekQuote.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 22 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@
"name": "star-trek-ipsum",
"version": "1.0.0",
"description": "Returns a random Star Trek quote",
"author": "Milutin Pesikan <[email protected]>",
"license": "MIT",
"repository": "Milutin-P/star-trek-ipsum",
"homepage": "https://github.com/Milutin-P/star-trek-ipsum",
"repository": {
"type": "git",
"url": "https://github.com/Milutin-P/star-trek-ipsum.git"
},
"bugs": {
"url": "https://github.com/Milutin-P/star-trek-ipsum/issues"
},
"main": "index.js",
"keywords": [
"star",
"trek",
"ipsum",
"generator"
]
}
"star",
"trek",
"lorem",
"ipsum",
"quote",
"generator",
"string",
"random"
],
"devDependencies": {
"eslint": "^8.11.0"
}
}

0 comments on commit 79c6607

Please sign in to comment.