Chapter 5: prettier

This commit is contained in:
Beth Griggs
2020-05-20 01:21:55 +01:00
parent ce759b45a7
commit a0cf6a254c
11 changed files with 41 additions and 3900 deletions
-1
View File
@@ -1 +0,0 @@
node_modules
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,17 +1,17 @@
{ {
"name": "consuming-modules", "name": "consuming-modules",
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "description": "",
"main": "require-express.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"description": "",
"dependencies": { "dependencies": {
"express": "^4.17.1" "express": "^4.17.1"
}, },
"devDependencies": { "devDependencies": {
"standard": "^14.3.3" "prettier": "2.0.5"
} }
} }
@@ -0,0 +1 @@
const express = require("express");
-1
View File
@@ -1 +0,0 @@
const express = require('express');
@@ -1 +1 @@
export const name = 'Beth' export const name = "Beth";
+5 -5
View File
@@ -1,11 +1,11 @@
import express from 'express' import express from "express";
import { name } from './get-name/index.mjs' import { name } from "./get-name/index.mjs";
const PORT = 3000; const PORT = 3000;
const app = express(); const app = express();
app.get('/', (req, res) => res.send(`Hello from ${name}!`)) app.get("/", (req, res) => res.send(`Hello from ${name}!`));
app.listen(PORT, () => { app.listen(PORT, () => {
console.log("Express server started on port", PORT); console.log("Express server started on port", PORT);
}) });
+7 -5
View File
@@ -3,6 +3,7 @@
Reverses the words of a sentence. Reverses the words of a sentence.
## Install ## Install
```sh ```sh
npm install @bethany.griggs/reverse-sentence npm install @bethany.griggs/reverse-sentence
``` ```
@@ -15,16 +16,17 @@ reverse(sentence) => String
``` ```
## Example ## Example
```js ```js
const reverseSentence = require('reverse-sentence'); const reverseSentence = require("reverse-sentence");
const sentence = "Hello Beth!"; const sentence = "Hello Beth!";
const reversed = reverseSentence(sentence); const reversed = reverseSentence(sentence);
console.log(reversed) // Beth! Hello console.log(reversed); // Beth! Hello
``` ```
## License ## License
MIT MIT
+7 -7
View File
@@ -1,8 +1,8 @@
module.exports = reverse module.exports = reverse;
function reverse (sentence) { function reverse(sentence) {
const wordsArray = sentence.split(' ') const wordsArray = sentence.split(" ");
const reversedArray = wordsArray.reverse() const reversedArray = wordsArray.reverse();
const reversedSentence = reversedArray.join(' ') const reversedSentence = reversedArray.join(" ");
return reversedSentence return reversedSentence;
}; }
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -4,7 +4,7 @@
"description": "Reverses a sentence.", "description": "Reverses a sentence.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"lint": "standard", "lint": "./node_modules/prettier/bin-prettier.js . --write",
"prepublish": "npm run lint", "prepublish": "npm run lint",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
@@ -19,6 +19,6 @@
}, },
"homepage": "https://github.com/BethGriggs/reverse-sentence#readme", "homepage": "https://github.com/BethGriggs/reverse-sentence#readme",
"devDependencies": { "devDependencies": {
"standard": "^14.3.3" "prettier": "2.0.5"
} }
} }