Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"jest": true,
"es6": true
},
"globals": {
"err": true,
"req": true,
"res": true,
"next": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-console": "off",
"indent": [ "error", 2 ],
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
"comma-dangle": ["error", "always-multiline"],
"semi": [ "error", "always" ]
}
}
100 changes: 100 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@

# Created by https://www.gitignore.io/api/node,macos,visualstudiocode

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history

# End of https://www.gitignore.io/api/node,macos,visualstudiocodes
53 changes: 0 additions & 53 deletions README.md

This file was deleted.

5 changes: 5 additions & 0 deletions lab-david/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/node_modules/*
**/vendor/*
**/*.min.js
**/coverage/*
**/build/*
26 changes: 26 additions & 0 deletions lab-david/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"jest": true,
"es6": true
},
"globals": {
"err": true,
"req": true,
"res": true,
"next": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-console": "off",
"indent": [ "error", 2 ],
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
"comma-dangle": ["error", "always-multiline"],
"semi": [ "error", "always" ]
}
}
100 changes: 100 additions & 0 deletions lab-david/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@

# Created by https://www.gitignore.io/api/node,macos,visualstudiocode

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history

# End of https://www.gitignore.io/api/node,macos,visualstudiocodes
28 changes: 28 additions & 0 deletions lab-david/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@


## Exported values
* greet.js will take an input and export the phrase "hello <name>"
* If the input is not a string, it will return null
* arithmetic will take two numbers and return either their sum via addition or difference via subtraction

## Functions
* Greet - *only takes one parameter, a name (string)*
* Arithmetic - *only takes two parameters (numbers)*

## Tests
* tests are in the [test folder](/__test__)

## Files
* **.gitignore** - files for git to ignore
* **.eslintrc** - the linter config
* **.eslintignore** - the linter ignore config
* **lib/** - contains module definitions

## Frameworks / Languages
* Uses JEST and Node.js

## Author
* David A. Lindahl

## Purpose
* Written for Code Fellows 401 Full Stack Javascript course.
27 changes: 27 additions & 0 deletions lab-david/__test__/arithmetic.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

const arithmetic = require('../lib/arithmetic.js');

describe('arithmetic.test.js', () => {
describe('arithmetic.add', () => {

test('arithmetic.add should return the sum of two numbers', () => {
expect(arithmetic.add(1, 1)).toEqual(2);
});

test('arithmetic.add should return null if either parameter is a non-number', () => {
expect(arithmetic.add('')).toEqual('null');
});
});

describe('arithmetic.sub', () => {

test('arithmetic.sub should return the difference between two numbers', () => {
expect(arithmetic.sub(1, 1)).toEqual(0);
});

test('arithmetic.sub should return null if either parameter is a non-number', () => {
expect(arithmetic.sub('')).toEqual('null');
});
});
});
16 changes: 16 additions & 0 deletions lab-david/__test__/greet.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

const greet = require('../lib/greet.js');

describe('greet.test.js', () => {
describe('greet.hi', () => {

test('greet.hi should return "hello <name>" if no errors are present', () => {
expect(greet.hi('fred')).toEqual('hello fred');
});

test('greet.hi should return null when user supplies non string values', () => {
expect(greet.hi('')).toEqual('null');
});
});
});
Loading