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
5 changes: 5 additions & 0 deletions lab-mark/.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-mark/.eslintrc
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" ]
}
}
128 changes: 128 additions & 0 deletions lab-mark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@

# Created by https://www.gitignore.io/api/osx,node,linux,windows

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### 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


### OSX ###
*.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

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/osx,node,linux,windows
18 changes: 18 additions & 0 deletions lab-mark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
![CF](https://camo.githubusercontent.com/70edab54bba80edb7493cad3135e9606781cbb6b/687474703a2f2f692e696d6775722e636f6d2f377635415363382e706e67) Code-401-Javascript Lab-1
===
This is day 1 of lab with Code Fellows and it teaches students the fundamentals of testing node applications with jest.
# Modules
Description of exported values of each module defined in lib/ directory, along with arity and expected input/return values.
### Greet.js
Exports a single function with arity of one, that takes in a string and returns a string concatenation of "hello " + string.
If parameter is not a string, returns null.
### Arithmetic.js
Exports an object has add and sub methods that implement addition and subtraction.
- ##### add()
- The add method has an arity of two
- If either parameter is a non-number the function returns null
- Else returns the sum of the 2 numbers.
- ##### sub()
- The sub method has an arity of two
- If either parameter is a non-number the function returns null
- Else returns the second parameter subtracted from the first parameter
21 changes: 21 additions & 0 deletions lab-mark/lib/arithmetic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

/*
* The add method has an arity of two
* If either parameter is a non-number the function returns null
* Else returns the sum of the 2 numbers.
*/

module.exports.add = function(num1, num2) {
return typeof num1 != 'number' || typeof num2 != 'number' ? null : num1 + num2;
};

/*
* The sub method has an arity of two
* If either parameter is a non-number the function returns null
* Else return the second parameter subtracted from the first parameter
*/

module.exports.sub = function(num1, num2) {
return typeof num1 != 'number' || typeof num2 != 'number' ? null : num1 - num2;
};
10 changes: 10 additions & 0 deletions lab-mark/lib/greet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

/*
* Export a function that takes in a name and returns "hello " + name
* If name is not a string, returns null.
*/

module.exports = function(name) {
return typeof name === 'string' ? `hello ${name}` : null;
}
Loading