Skip to content
5 changes: 5 additions & 0 deletions .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 .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" ]
}
}
80 changes: 80 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

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

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


# End of https://www.gitignore.io/api/node,linux
48 changes: 48 additions & 0 deletions DIRECTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
![cf](https://i.imgur.com/7v5ASc8.png) 02: Tools and Context
======

## Submission Instructions
* Work in a fork of this repository
* Work in a branch on your fork
* Write all of your code in a directory named `lab-` + `<your name>` **e.g.** `lab-susan`
* Open a pull request to this repository
* Submit on canvas a question and observation, how long you spent, and a link to your pull request

## Configuration
Configure the root of your repository with the following files and directories. Thoughtfully name and organize any additional configuration or module files.
* **README.md** - contains documentation
* **.gitignore** - contains a [robust](http://gitignore.io) `.gitignore` file
* **.eslintrc** - contains the course linter configuration
* **.eslintignore** - contains the course linter ignore configuration
* **package.json** - contains npm package config
* create a `lint` script for running eslint
* create a `test` script for running tests
* **lib/** - contains module definitions
* **\_\_test\_\_/** - contains unit tests

## Feature Tasks
#### fp Module
Create a NodeJS module in the lib/ directory named fp.js that exports an object. Create stand-alone `map`, `filter`, `reduce`, and `slice` functions using the `call` and `apply` function methods. Define each function using ES6 lexical arrow function syntax.

In each function error-check each parameter and throw an Error with a meaningful message if the function is invoked with invalid arguments. Do not use any third party libraries in the FP module.

* `fp.map` and `fp.filter` should have the function signature `(callback, collection) => Array`
* `fp.reduce` should have the function signature `(callback, initialState, collection) => data`
* `fp.slice` should have the function signature `(begin, end, collection) => Array`

## Testing
#### FP Module Tests
Create a NodeJS module in the \_\_test\_\_/ named fp.test.js that asserts the correctness of the fp module.

* Use TDD `describe` and `test` methods to define descriptive tests
* Each `test` callback should aim to test a small well defined feature of a function
* Write tests to ensure the fp module functions correctly error-check parameters
* Assert that the correct errors are thrown with invalid arguments
* Write tests to ensure the fp module functions returns the correct results when invoked with valid arguments

## Documentation
In your README.md describe the exported values of each module you have defined. Every function description should include it's arity (expected number of parameters), the expected data for each parameters (data-type and limitations), and it's behavior (for both valid and invalid use). Feel free to write any additional information in your README.md.

## Bonus 2pts
* Create a second module fp-curry.js that is a refactored version of fp.js, where each function has curried arguments
* Create a fp-curry.test.js that is a refactored version of fp.curry.js that tests fp-curry.js
62 changes: 14 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,14 @@
![cf](https://i.imgur.com/7v5ASc8.png) 02: Tools and Context
======

## Submission Instructions
* Work in a fork of this repository
* Work in a branch on your fork
* Write all of your code in a directory named `lab-` + `<your name>` **e.g.** `lab-susan`
* Open a pull request to this repository
* Submit on canvas a question and observation, how long you spent, and a link to your pull request

## Configuration
Configure the root of your repository with the following files and directories. Thoughtfully name and organize any additional configuration or module files.
* **README.md** - contains documentation
* **.gitignore** - contains a [robust](http://gitignore.io) `.gitignore` file
* **.eslintrc** - contains the course linter configuration
* **.eslintignore** - contains the course linter ignore configuration
* **package.json** - contains npm package config
* create a `lint` script for running eslint
* create a `test` script for running tests
* **lib/** - contains module definitions
* **\_\_test\_\_/** - contains unit tests

## Feature Tasks
#### fp Module
Create a NodeJS module in the lib/ directory named fp.js that exports an object. Create stand-alone `map`, `filter`, `reduce`, and `slice` functions using the `call` and `apply` function methods. Define each function using ES6 lexical arrow function syntax.

In each function error-check each parameter and throw an Error with a meaningful message if the function is invoked with invalid arguments. Do not use any third party libraries in the FP module.

* `fp.map` and `fp.filter` should have the function signature `(callback, collection) => Array`
* `fp.reduce` should have the function signature `(callback, initialState, collection) => data`
* `fp.slice` should have the function signature `(begin, end, collection) => Array`

## Testing
#### FP Module Tests
Create a NodeJS module in the \_\_test\_\_/ named fp.test.js that asserts the correctness of the fp module.

* Use TDD `describe` and `test` methods to define descriptive tests
* Each `test` callback should aim to test a small well defined feature of a function
* Write tests to ensure the fp module functions correctly error-check parameters
* Assert that the correct errors are thrown with invalid arguments
* Write tests to ensure the fp module functions returns the correct results when invoked with valid arguments

## Documentation
In your README.md describe the exported values of each module you have defined. Every function description should include it's arity (expected number of parameters), the expected data for each parameters (data-type and limitations), and it's behavior (for both valid and invalid use). Feel free to write any additional information in your README.md.

## Bonus 2pts
* Create a second module fp-curry.js that is a refactored version of fp.js, where each function has curried arguments
* Create a fp-curry.test.js that is a refactored version of fp.curry.js that tests fp-curry.js
# Lab 02

## exports

###fp
fp exports four customized functions that affect arrays
####fp.map
takes in a callback function, and an array or array like object and returns an array of modified values. it also catches errors and returns a descriptive error message
####fp.slice
takes in an array or array like object, a begin, and an optional end and returns an array containing a subset of the original array. it also catches errors and returns a descriptive error message
####fp.reduce
takes in a callback function, an array or array like object and an inital value and returns a value or string built out of the original array. it also catches errors and returns a descriptive error message
####fp.filter
takes in a callback function, and an array or array like object and returns an array of values that match the conditions. it also catches errors and returns a descriptive error message
Loading