diff --git a/exercism/anagram/anagram.spec.js b/exercism/anagram/anagram.spec.js index ca71bd9..ee7a866 100644 --- a/exercism/anagram/anagram.spec.js +++ b/exercism/anagram/anagram.spec.js @@ -9,63 +9,63 @@ describe('Anagram', function() { expect(matches).toEqual([]); }); - xit('detects simple anagram',function() { + it('detects simple anagram',function() { var subject = new Anagram('ant'); var matches = subject.matches(['tan', 'stand', 'at']); expect(matches).toEqual(['tan']); }); - xit('does not detect false positives',function() { + it('does not detect false positives',function() { var subject = new Anagram('galea'); var matches = subject.matches(['eagle']); expect(matches).toEqual([]); }); - xit('detects multiple anagrams',function() { + it('detects multiple anagrams',function() { var subject = new Anagram('master'); var matches = subject.matches(['stream', 'pigeon', 'maters']); expect(matches).toEqual(['stream', 'maters']); }); - xit('does not detect anagram subsets',function() { + it('does not detect anagram subsets',function() { var subject = new Anagram('good'); var matches = subject.matches(['dog', 'goody']); expect(matches).toEqual([]); }); - xit('detects anagram',function() { + it('detects anagram',function() { var subject = new Anagram('listen'); var matches = subject.matches(['enlists', 'google', 'inlets', 'banana']); expect(matches).toEqual(['inlets']); }); - xit('detects multiple anagrams',function() { + it('detects multiple anagrams',function() { var subject = new Anagram('allergy'); var matches = subject.matches(['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading']); expect(matches).toEqual(['gallery', 'regally', 'largely']); }); - xit('detects anagrams case-insensitively',function() { + it('detects anagrams case-insensitively',function() { var subject = new Anagram('Orchestra'); var matches = subject.matches(['cashregister', 'Carthorse', 'radishes']); expect(matches).toEqual(['Carthorse']); }); - xit('does not detect a word as its own anagram',function() { + it('does not detect a word as its own anagram',function() { var subject = new Anagram('banana'); var matches = subject.matches(['Banana']); expect(matches).toEqual([]); }); - xit('matches() accepts string arguments',function() { + it('matches() accepts string arguments',function() { var subject = new Anagram('ant'); var matches = subject.matches('stand', 'tan', 'at'); diff --git a/exercism/binary-search/binary-search.js b/exercism/binary-search/binary-search.js new file mode 100644 index 0000000..772ffbb --- /dev/null +++ b/exercism/binary-search/binary-search.js @@ -0,0 +1,35 @@ +function BinarySearch( arr ) { +//an object taht has a state and the reason it can change is because it has some +//data it's holding onto and some functions that can act on that data. +//that means there's a state change + this.arr = arr +} + +BinarySearch.prototype.indexOf = function( value ) { + //check if this.arr is sorted + // + + // on the prototoype of bin search we're gonna have a method called index of + +} + + java + + var checkIfArrayIsSorted = function(arr) { + for(var i = 0; i < arr.length; i ++) { + if (arr[i] < arr[i+1]) { + return true; + } else { + return false; + } + } + } + +c++ + + + for(var i = 0; i < thing.length; i++) { + if (thing[i] > thing[i+1]) { + console.log('false'); + } + } diff --git a/exercism/etl/etl.js b/exercism/etl/etl.js new file mode 100644 index 0000000..c9b8f05 --- /dev/null +++ b/exercism/etl/etl.js @@ -0,0 +1,20 @@ +function ETL() { + +} + +ETL.prototype.transform = function( oldData ) { + var newData = {} + + for ( prop in oldData ) { + var individualArray = oldData[prop] + + while ( individualArray.length > 0 ) { + var letter = individualArray.pop().toLowerCase() + + newData[letter] = Number(prop) + } + } + return newData +} + +module.exports = ETL diff --git a/exercism/etl/etl.spec.js b/exercism/etl/etl.spec.js index f213284..3c1baaf 100644 --- a/exercism/etl/etl.spec.js +++ b/exercism/etl/etl.spec.js @@ -3,6 +3,7 @@ var ETL = require('./etl'); describe('Transform', function() { var etl = new ETL(); + it('transforms one value', function() { var old = { 1: ['A'] }; var expected = { a: 1 }; @@ -10,21 +11,21 @@ describe('Transform', function() { expect(etl.transform(old)).toEqual(expected); }); - xit('transforms more values', function() { + it('transforms more values', function() { var old = { 1: ['A', 'E', 'I', 'O', 'U'] }; var expected = { a: 1, e: 1, i: 1, o: 1, u: 1 }; expect(etl.transform(old)).toEqual(expected); }); - xit('transforms more keys', function() { + it('transforms more keys', function() { var old = { 1: ['A', 'E'], 2: ['D', 'G'] }; var expected = { a: 1, e: 1, d: 2, g: 2 }; expect(etl.transform(old)).toEqual(expected); }); - xit('transforms a full dataset', function() { + it('transforms a full dataset', function() { var old = { 1: [ 'A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T' ], 2: [ 'D', 'G' ], diff --git a/exercism/pangram/pangram.spec.js b/exercism/pangram/pangram.spec.js index d7feee3..828f9eb 100644 --- a/exercism/pangram/pangram.spec.js +++ b/exercism/pangram/pangram.spec.js @@ -7,42 +7,43 @@ describe('Pangram()', function() { expect(pangram.isPangram()).toBe(false); }); - xit('pangram with only lower case', function() { + it('pangram with only lower case', function() { var pangram = new Pangram("the quick brown fox jumps over the lazy dog"); expect(pangram.isPangram()).toBe(true); }); - xit("missing character 'x'", function() { + it("missing character 'x'", function() { var pangram = new Pangram("a quick movement of the enemy will jeopardize five gunboats"); expect(pangram.isPangram()).toBe(false); }); - xit("another missing character 'x'", function() { + it("another missing character 'x'", function() { var pangram = new Pangram("the quick brown fish jumps over the lazy dog"); expect(pangram.isPangram()).toBe(false); }); - xit("pangram with underscores", function() { + it("pangram with underscores", function() { var pangram = new Pangram("the_quick_brown_fox_jumps_over_the_lazy_dog"); expect(pangram.isPangram()).toBe(true); }); - xit("pangram with numbers", function() { + it("pangram with numbers", function() { var pangram = new Pangram("the 1 quick brown fox jumps over the 2 lazy dogs"); expect(pangram.isPangram()).toBe(true); }); - xit('missing letters replaced by numbers', function() { + it('missing letters replaced by numbers', function() { var pangram = new Pangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"); + console.log() expect(pangram.isPangram()).toBe(false); }); - xit('pangram with mixed case and punctuation', function() { + it('pangram with mixed case and punctuation', function() { var pangram = new Pangram("\"Five quacking Zephyrs jolt my wax bed.\""); expect(pangram.isPangram()).toBe(true); }); - xit('pangram with non-ascii characters', function() { + it('pangram with non-ascii characters', function() { var pangram = new Pangram("Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich."); expect(pangram.isPangram()).toBe(true); });