Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1c24045
test works
adoxic Sep 16, 2019
9f31b03
added whiteboard
adoxic Sep 16, 2019
9c6ac7b
test works
adoxic Sep 17, 2019
dfd32d1
add whiteboard
adoxic Sep 17, 2019
92a481d
add to readme
adoxic Sep 17, 2019
2579528
corrected tests
adoxic Sep 18, 2019
11deadb
test passes
adoxic Sep 19, 2019
e45ffe5
added to readme and whiteboard
adoxic Sep 19, 2019
5c0844b
All tests pass
adoxic Sep 28, 2019
04d6c01
update readme
adoxic Sep 28, 2019
b07a845
all methods work and tested
adoxic Sep 28, 2019
a9057f7
readme and added whiteboard to assets
adoxic Sep 28, 2019
e2cd394
all methods and tests work
adoxic Sep 28, 2019
7308a57
readme
adoxic Sep 28, 2019
a3faade
new function works and is tested
adoxic Sep 29, 2019
2aafab3
all tests work and new readme
adoxic Oct 5, 2019
b7e77fd
trying to find out why there is no travis
adoxic Oct 5, 2019
54732f6
small edit
adoxic Oct 5, 2019
07fecbe
git
adoxic Oct 5, 2019
30c8558
think it's working
adoxic Oct 5, 2019
ca5df3b
lint
adoxic Oct 5, 2019
c9bb684
readmes
adoxic Oct 5, 2019
901ab34
all tests passing
adoxic Oct 6, 2019
c9d3507
tests work
adoxic Oct 6, 2019
0de47e0
lint
adoxic Oct 6, 2019
4f00d97
readme
adoxic Oct 6, 2019
5a8258a
added picture update readme
adoxic Oct 6, 2019
92cb0b8
some stuff works?
adoxic Oct 7, 2019
7a4c4bc
a fix
adoxic Oct 7, 2019
eda932f
got the rest of the tests
adoxic Oct 12, 2019
85fd7f2
wrote most of test and methods
adoxic Oct 12, 2019
cef6175
test passes
adoxic Oct 12, 2019
4d7f719
added picture and readme info
adoxic Oct 12, 2019
35a72ae
travis
adoxic Oct 12, 2019
9060287
loot at this mess aghhh refactoring this to work for my use is hard :(
adoxic Oct 13, 2019
aa5af50
this also doesn't work but seems closer
adoxic Oct 13, 2019
140b159
it worksgit add .
adoxic Oct 14, 2019
16dcaa6
readme and picture
adoxic Oct 14, 2019
144d138
travis link
adoxic Oct 14, 2019
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
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/node_modules/*
**/*.min.js
**/vendor/*
**/coverage/*
**/build/*
**/docs/*
25 changes: 25 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"jest": true,
"es6": true
},
"globals": {
"fail":true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2018
},
"rules": {
"no-console": "off",
"indent": [ "error", 2 ],
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
"comma-dangle": ["error", "always-multiline"],
"semi": [ "error", "always" ],
"no-unused-vars": [1, {"vars": "local", "args": "none"}]
}
}
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto

# Align with eslint linebreak-style: [ "error", "unix" ]
*.js text eol=lf
145 changes: 145 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# 401 JS
db
.env
temp
build

# Created by https://www.gitignore.io/api/vim,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

### Vim ###
# swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# session
Session.vim
# temporary
.netrwhist
# auto-generated tag files
tags

### 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/vim,osx,node,linux,windows
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
node_js:
- "stable"
branches:
only:
- master
script:
- npm run lint
- npm test

13 changes: 13 additions & 0 deletions Chalenges/_test_/array-binary-sort.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const findIndex = require('../arrayBinarySort/array-binary-sort');

const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
const find = 3;

describe('array tests', () => {

const result = findIndex(arr, find);

test('did find array index', () => {
expect(result).toBe(2);
});
});
11 changes: 11 additions & 0 deletions Chalenges/_test_/array-reverse.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const reverseArray = require('../arrayRerverse/array-reverse');

const testArr = [1, 2, 3];
const result = reverseArray(testArr);

describe.skip('array tests', () => {

test('is array reversed', () => {
expect(result).toStrictEqual([3, 2, 1]);
});
});
18 changes: 18 additions & 0 deletions Chalenges/_test_/array-shift.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const array = require('../arrayShift/array-shift');


describe('array tests', () => {

it('is array shifted', () => {
const testArr = [2, 3, 4, 5];
const result = array.arrayShift(testArr, 1);
expect(result).toStrictEqual([1, 2, 3, 4, 5]);
});

it('is array shifted', () => {
const testArr = [1, 2, 4, 5];
const result = array.arraySplice(testArr, 3);
expect(result).toStrictEqual([1, 2, 3, 4, 5]);
});

});
90 changes: 90 additions & 0 deletions Chalenges/_test_/binary-tree.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
const TreeNode = require('../binaryTree/binary-tree');

describe('make and traverse a binary tree', () => {
it('make a tree', () => {
const newTree = new TreeNode();
expect(newTree.root).toBe(null);

newTree.add(6);
newTree.add(8);
newTree.add(4);

expect(newTree.root.value).toBe(6);
expect(newTree.root.left.value).toBe(4);
expect(newTree.root.right.value).toBe(8);
});

it('make a tree', () => {
const newTree = new TreeNode();
expect(newTree.root).toBe(null);

newTree.add(6);
newTree.add(8);
newTree.add(4);
newTree.add(2);

expect(newTree.root.value).toBe(6);
expect(newTree.root.left.value).toBe(4);
expect(newTree.root.left.left.value).toBe(2);
expect(newTree.root.right.value).toBe(8);
});

it('preOrder tree', () => {
const newTree = new TreeNode();
expect(newTree.root).toBe(null);

newTree.add(6);
newTree.add(8);
newTree.add(4);
newTree.add(2);
newTree.add(3);

const values = newTree.preOrder();
expect(values).toEqual([6, 4, 2, 3, 8]);
});

it('inOrder tree', () => {
const newTree = new TreeNode();
expect(newTree.root).toBe(null);

newTree.add(6);
newTree.add(8);
newTree.add(4);
newTree.add(2);
newTree.add(1);

const values = newTree.inOrder();

expect(values).toEqual([1, 2, 4, 6, 8]);
});
it('postOrder tree', () => {
const newTree = new TreeNode();
expect(newTree.root).toBe(null);

newTree.add(6);
newTree.add(8);
newTree.add(4);
newTree.add(2);
newTree.add(1);

const values = newTree.postOrder();

expect(values).toEqual([6, 8, 4, 2, 1]);
});
it('breadth first tree', () => {
const newTree = new TreeNode();
expect(newTree.root).toBe(null);

newTree.add(6);
newTree.add(8);
newTree.add(4);
newTree.add(2);
newTree.add(5);
newTree.add(7);
newTree.add(9);

const values = newTree.breadthFirst();
console.log(values);
expect(values).toEqual([6, 4, 8, 2, 5, 7, 9]);
});
});
39 changes: 39 additions & 0 deletions Chalenges/_test_/bracket-validation.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const bracketValidation = require('../multiBracketValidation/bracket-validation');

describe('validate', () => {
it('true cases', () => {
const thing1 = '{}[]';
const actual1 = bracketValidation(thing1);
expect(actual1).toBe(true);

const thing2 = '()';
const actual2 = bracketValidation(thing2);
expect(actual2).toBe(true);

const thing3 = '({}[])';
const actual3 = bracketValidation(thing3);
expect(actual3).toBe(true);

const thing4 = '{[()]}';
const actual4 = bracketValidation(thing4);
expect(actual4).toBe(true);
});

it('false cases', () => {
const thing1 = '}]}[]';
const actual1 = bracketValidation(thing1);
expect(actual1).toBe(false);

const thing2 = '(';
const actual2 = bracketValidation(thing2);
expect(actual2).toBe(false);

const thing3 = '})';
const actual3 = bracketValidation(thing3);
expect(actual3).toBe(false);

const thing4 = '{)}}';
const actual4 = bracketValidation(thing4);
expect(actual4).toBe(false);
});
});
18 changes: 18 additions & 0 deletions Chalenges/_test_/fifo-animal-shelter.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const Animals = require('../fifoAnimalShelter/fifo-animal-shelter');

describe('make fifo animal model', () => {

it('make a shelter list', () => {
const shelter = new Animals();
shelter.enqueue('cat', 'boots');
shelter.enqueue('cat', 'snowball');
shelter.enqueue('dog', 'fido');
shelter.enqueue('dog', 'ella');
console.log(shelter);
const dog = shelter.dequeue('dog');
const cat = shelter.dequeue('cat');

expect(dog).toBe('fido');
expect(cat).toBe('boots');
});
});
Loading