├── .rspec ├── Gemfile ├── MIT.LICENSE ├── README.md ├── SpecRunner.html ├── generator.rb ├── lib └── jasmine-2.5.2 │ ├── boot.js │ ├── console.js │ ├── jasmine-html.js │ ├── jasmine.css │ ├── jasmine.js │ └── jasmine_favicon.png ├── list.csv ├── node_modules ├── .bin │ └── jasmine ├── balanced-match │ ├── .npmignore │ ├── LICENSE.md │ ├── README.md │ ├── index.js │ └── package.json ├── brace-expansion │ ├── README.md │ ├── index.js │ └── package.json ├── concat-map │ ├── .travis.yml │ ├── LICENSE │ ├── README.markdown │ ├── example │ │ └── map.js │ ├── index.js │ ├── package.json │ └── test │ │ └── map.js ├── exit │ ├── .jshintrc │ ├── .npmignore │ ├── .travis.yml │ ├── Gruntfile.js │ ├── LICENSE-MIT │ ├── README.md │ ├── lib │ │ └── exit.js │ ├── package.json │ └── test │ │ ├── exit_test.js │ │ └── fixtures │ │ ├── 10-stderr.txt │ │ ├── 10-stdout-stderr.txt │ │ ├── 10-stdout.txt │ │ ├── 100-stderr.txt │ │ ├── 100-stdout-stderr.txt │ │ ├── 100-stdout.txt │ │ ├── 1000-stderr.txt │ │ ├── 1000-stdout-stderr.txt │ │ ├── 1000-stdout.txt │ │ ├── create-files.sh │ │ ├── log-broken.js │ │ └── log.js ├── fs.realpath │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── old.js │ └── package.json ├── glob │ ├── LICENSE │ ├── README.md │ ├── changelog.md │ ├── common.js │ ├── glob.js │ ├── package.json │ └── sync.js ├── inflight │ ├── LICENSE │ ├── README.md │ ├── inflight.js │ └── package.json ├── inherits │ ├── LICENSE │ ├── README.md │ ├── inherits.js │ ├── inherits_browser.js │ └── package.json ├── jasmine-core │ ├── .codeclimate.yml │ ├── .editorconfig │ ├── .github │ │ ├── CONTRIBUTING.md │ │ └── ISSUE_TEMPLATE.md │ ├── .npmignore │ ├── MANIFEST.in │ ├── MIT.LICENSE │ ├── README.md │ ├── RELEASE.md │ ├── bower.json │ ├── images │ │ ├── jasmine-horizontal.png │ │ ├── jasmine-horizontal.svg │ │ └── jasmine_favicon.png │ ├── jasmine_core.egg-info │ │ ├── PKG-INFO │ │ ├── SOURCES.txt │ │ ├── dependency_links.txt │ │ ├── requires.txt │ │ └── top_level.txt │ ├── lib │ │ ├── console │ │ │ └── console.js │ │ ├── jasmine-core.js │ │ └── jasmine-core │ │ │ ├── boot.js │ │ │ ├── example │ │ │ ├── node_example │ │ │ │ ├── lib │ │ │ │ │ └── jasmine_examples │ │ │ │ │ │ ├── Player.js │ │ │ │ │ │ └── Song.js │ │ │ │ └── spec │ │ │ │ │ ├── helpers │ │ │ │ │ └── jasmine_examples │ │ │ │ │ │ └── SpecHelper.js │ │ │ │ │ └── jasmine_examples │ │ │ │ │ └── PlayerSpec.js │ │ │ ├── spec │ │ │ │ ├── PlayerSpec.js │ │ │ │ └── SpecHelper.js │ │ │ └── src │ │ │ │ ├── Player.js │ │ │ │ └── Song.js │ │ │ ├── jasmine-html.js │ │ │ ├── jasmine.css │ │ │ ├── jasmine.js │ │ │ ├── json2.js │ │ │ └── node_boot.js │ ├── package.json │ └── requirements.txt ├── jasmine │ ├── .travis.yml │ ├── Gruntfile.js │ ├── MIT.LICENSE │ ├── README.md │ ├── bin │ │ └── jasmine.js │ ├── lib │ │ ├── command.js │ │ ├── examples │ │ │ └── jasmine.json │ │ ├── exit.js │ │ ├── filters │ │ │ └── console_spec_filter.js │ │ ├── jasmine.js │ │ ├── printDeprecation.js │ │ └── reporters │ │ │ ├── completion_reporter.js │ │ │ └── console_reporter.js │ ├── package.json │ └── tasks │ │ └── jasmine.js ├── minimatch │ ├── LICENSE │ ├── README.md │ ├── minimatch.js │ └── package.json ├── once │ ├── LICENSE │ ├── README.md │ ├── once.js │ └── package.json ├── path-is-absolute │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md └── wrappy │ ├── LICENSE │ ├── README.md │ ├── package.json │ └── wrappy.js ├── problems ├── base_converter.js ├── binary_search.js ├── bubble_sort.js ├── caesar_cipher.js ├── deep_dup.js ├── digital_root.js ├── doubler.js ├── dups.js ├── exponent.js ├── factorials_rec.js ├── factors.js ├── fibs_sum.js ├── first_even_numbers_sum.js ├── inherits.js ├── jumble_sort.js ├── median.js ├── merge_sort.js ├── my_bind.js ├── my_call.js ├── my_curry.js ├── my_each.js ├── my_every.js ├── my_filter.js ├── my_find.js ├── my_flatten.js ├── my_inject.js ├── my_join.js ├── my_reject.js ├── my_reverse.js ├── my_rotate.js ├── my_slice.js ├── my_some.js ├── permutations.js ├── pig_latinify.js ├── prime_factorization.js ├── primes.js ├── quicksort.js ├── real_words_in_string.js ├── rec_sum.js ├── string_include_key.js ├── subsets.js ├── symmetric_substrings.js ├── titleize.js ├── transpose.js └── two_sum.js ├── solutions ├── base_converter_solution.js ├── binary_search_solution.js ├── bubble_sort_solution.js ├── caesar_cipher_solution.js ├── deep_dup_solution.js ├── digital_root_solution.js ├── doubler_solution.js ├── dups_solution.js ├── exponent_solution.js ├── factorials_rec_solution.js ├── factors_solution.js ├── fibs_sum_solution.js ├── first_even_numbers_sum_solution.js ├── inherits_solution.js ├── jumble_sort_solution.js ├── median_solution.js ├── merge_sort_solution.js ├── my_apply_solution.js ├── my_bind_solution.js ├── my_call_solution.js ├── my_curry_solution.js ├── my_each_solution.js ├── my_every_solution.js ├── my_filter_solution.js ├── my_find_solution.js ├── my_flatten_solution.js ├── my_inject_solution.js ├── my_join_solution.js ├── my_reject_solution.js ├── my_reverse_solution.js ├── my_rotate_solution.js ├── my_slice_solution.js ├── my_some_solution.js ├── permutations_solution.js ├── pig_latinify_solution.js ├── prime_factorization_solution.js ├── primes_solution.js ├── quicksort_solution.js ├── real_words_in_string_solution.js ├── rec_sum_solution.js ├── string_include_key_solution.js ├── subsets_solution.js ├── symmetric_substrings_solution.js ├── titleize_solution.js ├── transpose_solution.js └── two_sum_solution.js └── specs ├── base_converter_spec.js ├── binary_search_spec.js ├── bubble_sort_spec.js ├── caesar_cipher_spec.js ├── deep_dup_spec.js ├── digital_root_spec.js ├── doubler_spec.js ├── dups_spec.js ├── exponent_spec.js ├── factorials_rec_spec.js ├── factors_spec.js ├── fibs_sum_spec.js ├── first_even_numbers_sum_spec.js ├── inherits_spec.js ├── jumble_sort_spec.js ├── median_spec.js ├── merge_sort_spec.js ├── my_bind_spec.js ├── my_call_spec.js ├── my_curry_spec.js ├── my_each_spec.js ├── my_every_spec.js ├── my_filter_spec.js ├── my_find_spec.js ├── my_flatten_spec.js ├── my_inject_spec.js ├── my_join_spec.js ├── my_reject_spec.js ├── my_reverse_spec.js ├── my_rotate_spec.js ├── my_slice_spec.js ├── my_some_spec.js ├── permutations_spec.js ├── pig_latinify_spec.js ├── prime_factorization_spec.js ├── primes_spec.js ├── quicksort_spec.js ├── real_words_in_string_spec.js ├── rec_sum_spec.js ├── string_include_key_spec.js ├── subsets_spec.js ├── support └── jasmine.json ├── symmetric_substrings_spec.js ├── titleize_spec.js ├── transpose_spec.js └── two_sum_spec.js /.rspec: -------------------------------------------------------------------------------- 1 | --format=documentation 2 | --color 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # A sample Gemfile 3 | source "https://rubygems.org" 4 | 5 | gem 'jasmine' 6 | gem 'byebug' 7 | gem 'colorize' 8 | -------------------------------------------------------------------------------- /MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2016 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # a/A Practice Test Generator 2 | 3 | [Mallory](https://github.com/mallorybulkley/) created this simple CLI practice test generator during her first week at App Academy to help herself and other students prepare for our first assessment. She wanted a way to simulate the actual test rather than just solving practice problems individually. The questions, Jasmine tests, and solutions were largely pulled from exercises we had encountered during the prepwork and first week of class, or contributed by other students. I pulled on her work and refactored it into JavaScript. 4 | 5 | 6 | All of the practice problems are listed and categorized in `list.csv` (categories include: recursion, sorting, enumerable, array, string). When you run `generator.rb` on the command line and provide your desired number of questions from each category, it uses your input and the CSV file to randomly select practice problems. It combines these problems and writes 3 new files inside the repo folder: 7 | * `practice_test.js` contains the problems to be solved 8 | * `spec.js` combines the specs for the chosen problems into one file for easy testing 9 | * `solutions.js` combines the solutions for each problem 10 | 11 | ## How to use this generator 12 | 13 | 1. Clone this repo 14 | 15 | 2. Navigate to the folder in terminal and run 16 | `ruby generator.rb` 17 | 18 | 3. Input your practice test requests in the form `category: # of problems` 19 | 20 | 4. You will now have three new files: `practice_test.js`, `spec.js` and `solutions.js`. Once these files are created, open `SpecRunner.html` in your browser. If you have not generated these files, the page will not open. 21 | 22 | 5. Check your solutions against those in `solutions.js`. 23 | 24 | Note: if you run the generator again in the same folder, it will re-write those three files and erase your previous work. If you wish to save your previous work, you will need to rename the files. 25 | -------------------------------------------------------------------------------- /SpecRunner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Jasmine Spec Runner v2.5.2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /generator.rb: -------------------------------------------------------------------------------- 1 | require 'csv' 2 | require 'colorize' 3 | 4 | # Instructions 5 | system("clear") 6 | puts "Welcome to Mallory's a/A Practice Assessment Generator".cyan 7 | puts "This generator will create a practice test based on your input. " \ 8 | "You can choose how many problems from each category to include in your test. " 9 | puts "This program will generate 3 files in this folder: practice_test, spec, and solution. " \ 10 | "Complete the practice_test file, running the spec file to check your answers. " \ 11 | "When your time is up (you are timing yourself, right?), compare your answers to the solutions." 12 | puts "Good luck!" 13 | 14 | # read in csv with test info 15 | tests = CSV.read('list.csv', headers: true, header_converters: :symbol, converters: :all) 16 | 17 | # list possible categories 18 | categories = Array.new 19 | tests.each do |test| 20 | categories << test[1] 21 | end 22 | categories = categories.uniq 23 | puts "Possible categories: #{categories.join(", ")}".magenta 24 | puts 25 | 26 | # get user request 27 | puts "Input your requests, separated by commas and spaces please" 28 | puts "Example input: " + "array: 2, recursion: 1, etc. ".yellow 29 | input = gets.chomp.split(", ") 30 | 31 | categoryrequests = Hash.new(0) 32 | input.each do |request| 33 | req = request.downcase.split(": ") 34 | categoryrequests[req[0]] = req[1].to_i 35 | end 36 | 37 | # make test array for each category 38 | master = Array.new 39 | categories.each do |category| 40 | problems_in_category = Array.new 41 | tests.each do |test| 42 | if category == test[1] 43 | problems_in_category << test 44 | end 45 | end 46 | 47 | # pick tests at random from each category 48 | n = categoryrequests[category] 49 | master = master.concat(problems_in_category.sample(n)) 50 | end 51 | 52 | # create new test, spec and solution files 53 | practice_test = File.open("practice_test.js", "w") 54 | spec = File.open("spec.js", "w") 55 | solution = File.open("solution.js", "w") 56 | 57 | # require rspec and the practice_test in the spec 58 | # spec << "import Jasmine from 'jasmine';" << "\n" 59 | # spec << "import practiceTest from './practice_test';" << "\n" 60 | 61 | # loop through master tests and add text to the new files 62 | master.each do |test| 63 | practice_test << File.read(test[2]) << "\n" 64 | spec << File.read(test[3]) << "\n" 65 | solution << File.read(test[4]) << "\n" 66 | end 67 | 68 | # close the files that were just created 69 | practice_test.close 70 | spec.close 71 | solution.close 72 | 73 | puts 74 | puts "Done!" 75 | -------------------------------------------------------------------------------- /lib/jasmine-2.5.2/jasmine_favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/souiukoto/javascript-test-generator/01b267999b1b9a47675a89de95c3383454d3a561/lib/jasmine-2.5.2/jasmine_favicon.png -------------------------------------------------------------------------------- /node_modules/.bin/jasmine: -------------------------------------------------------------------------------- 1 | ../jasmine/bin/jasmine.js -------------------------------------------------------------------------------- /node_modules/balanced-match/.npmignore: -------------------------------------------------------------------------------- 1 | test 2 | .gitignore 3 | .travis.yml 4 | Makefile 5 | example.js 6 | -------------------------------------------------------------------------------- /node_modules/balanced-match/LICENSE.md: -------------------------------------------------------------------------------- 1 | (MIT) 2 | 3 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/balanced-match/README.md: -------------------------------------------------------------------------------- 1 | # balanced-match 2 | 3 | Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! 4 | 5 | [![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) 6 | [![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) 7 | 8 | [![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) 9 | 10 | ## Example 11 | 12 | Get the first matching pair of braces: 13 | 14 | ```js 15 | var balanced = require('balanced-match'); 16 | 17 | console.log(balanced('{', '}', 'pre{in{nested}}post')); 18 | console.log(balanced('{', '}', 'pre{first}between{second}post')); 19 | console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); 20 | ``` 21 | 22 | The matches are: 23 | 24 | ```bash 25 | $ node example.js 26 | { start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } 27 | { start: 3, 28 | end: 9, 29 | pre: 'pre', 30 | body: 'first', 31 | post: 'between{second}post' } 32 | { start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } 33 | ``` 34 | 35 | ## API 36 | 37 | ### var m = balanced(a, b, str) 38 | 39 | For the first non-nested matching pair of `a` and `b` in `str`, return an 40 | object with those keys: 41 | 42 | * **start** the index of the first match of `a` 43 | * **end** the index of the matching `b` 44 | * **pre** the preamble, `a` and `b` not included 45 | * **body** the match, `a` and `b` not included 46 | * **post** the postscript, `a` and `b` not included 47 | 48 | If there's no match, `undefined` will be returned. 49 | 50 | If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. 51 | 52 | ### var r = balanced.range(a, b, str) 53 | 54 | For the first non-nested matching pair of `a` and `b` in `str`, return an 55 | array with indexes: `[ , ]`. 56 | 57 | If there's no match, `undefined` will be returned. 58 | 59 | If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. 60 | 61 | ## Installation 62 | 63 | With [npm](https://npmjs.org) do: 64 | 65 | ```bash 66 | npm install balanced-match 67 | ``` 68 | 69 | ## License 70 | 71 | (MIT) 72 | 73 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> 74 | 75 | Permission is hereby granted, free of charge, to any person obtaining a copy of 76 | this software and associated documentation files (the "Software"), to deal in 77 | the Software without restriction, including without limitation the rights to 78 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 79 | of the Software, and to permit persons to whom the Software is furnished to do 80 | so, subject to the following conditions: 81 | 82 | The above copyright notice and this permission notice shall be included in all 83 | copies or substantial portions of the Software. 84 | 85 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 86 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 87 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 88 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 89 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 90 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 91 | SOFTWARE. 92 | -------------------------------------------------------------------------------- /node_modules/balanced-match/index.js: -------------------------------------------------------------------------------- 1 | module.exports = balanced; 2 | function balanced(a, b, str) { 3 | if (a instanceof RegExp) a = maybeMatch(a, str); 4 | if (b instanceof RegExp) b = maybeMatch(b, str); 5 | 6 | var r = range(a, b, str); 7 | 8 | return r && { 9 | start: r[0], 10 | end: r[1], 11 | pre: str.slice(0, r[0]), 12 | body: str.slice(r[0] + a.length, r[1]), 13 | post: str.slice(r[1] + b.length) 14 | }; 15 | } 16 | 17 | function maybeMatch(reg, str) { 18 | var m = str.match(reg); 19 | return m ? m[0] : null; 20 | } 21 | 22 | balanced.range = range; 23 | function range(a, b, str) { 24 | var begs, beg, left, right, result; 25 | var ai = str.indexOf(a); 26 | var bi = str.indexOf(b, ai + 1); 27 | var i = ai; 28 | 29 | if (ai >= 0 && bi > 0) { 30 | begs = []; 31 | left = str.length; 32 | 33 | while (i >= 0 && !result) { 34 | if (i == ai) { 35 | begs.push(i); 36 | ai = str.indexOf(a, i + 1); 37 | } else if (begs.length == 1) { 38 | result = [ begs.pop(), bi ]; 39 | } else { 40 | beg = begs.pop(); 41 | if (beg < left) { 42 | left = beg; 43 | right = bi; 44 | } 45 | 46 | bi = str.indexOf(b, i + 1); 47 | } 48 | 49 | i = ai < bi && ai >= 0 ? ai : bi; 50 | } 51 | 52 | if (begs.length) { 53 | result = [ left, right ]; 54 | } 55 | } 56 | 57 | return result; 58 | } 59 | -------------------------------------------------------------------------------- /node_modules/balanced-match/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "balanced-match", 6 | "raw": "balanced-match@^0.4.1", 7 | "rawSpec": "^0.4.1", 8 | "scope": null, 9 | "spec": ">=0.4.1 <0.5.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/brace-expansion" 13 | ] 14 | ], 15 | "_from": "balanced-match@>=0.4.1 <0.5.0", 16 | "_id": "balanced-match@0.4.2", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/balanced-match", 20 | "_nodeVersion": "4.4.7", 21 | "_npmOperationalInternal": { 22 | "host": "packages-16-east.internal.npmjs.com", 23 | "tmp": "tmp/balanced-match-0.4.2.tgz_1468834991581_0.6590619895141572" 24 | }, 25 | "_npmUser": { 26 | "email": "julian@juliangruber.com", 27 | "name": "juliangruber" 28 | }, 29 | "_npmVersion": "2.15.8", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "balanced-match", 33 | "raw": "balanced-match@^0.4.1", 34 | "rawSpec": "^0.4.1", 35 | "scope": null, 36 | "spec": ">=0.4.1 <0.5.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/brace-expansion" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", 43 | "_shasum": "cb3f3e3c732dc0f01ee70b403f302e61d7709838", 44 | "_shrinkwrap": null, 45 | "_spec": "balanced-match@^0.4.1", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/brace-expansion", 47 | "author": { 48 | "email": "mail@juliangruber.com", 49 | "name": "Julian Gruber", 50 | "url": "http://juliangruber.com" 51 | }, 52 | "bugs": { 53 | "url": "https://github.com/juliangruber/balanced-match/issues" 54 | }, 55 | "dependencies": {}, 56 | "description": "Match balanced character pairs, like \"{\" and \"}\"", 57 | "devDependencies": { 58 | "tape": "^4.6.0" 59 | }, 60 | "directories": {}, 61 | "dist": { 62 | "shasum": "cb3f3e3c732dc0f01ee70b403f302e61d7709838", 63 | "tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz" 64 | }, 65 | "gitHead": "57c2ea29d89a2844ae3bdcc637c6e2cbb73725e2", 66 | "homepage": "https://github.com/juliangruber/balanced-match", 67 | "keywords": [ 68 | "match", 69 | "regexp", 70 | "test", 71 | "balanced", 72 | "parse" 73 | ], 74 | "license": "MIT", 75 | "main": "index.js", 76 | "maintainers": [ 77 | { 78 | "email": "julian@juliangruber.com", 79 | "name": "juliangruber" 80 | } 81 | ], 82 | "name": "balanced-match", 83 | "optionalDependencies": {}, 84 | "readme": "ERROR: No README data found!", 85 | "repository": { 86 | "type": "git", 87 | "url": "git://github.com/juliangruber/balanced-match.git" 88 | }, 89 | "scripts": { 90 | "test": "make test" 91 | }, 92 | "testling": { 93 | "browsers": [ 94 | "ie/8..latest", 95 | "firefox/20..latest", 96 | "firefox/nightly", 97 | "chrome/25..latest", 98 | "chrome/canary", 99 | "opera/12..latest", 100 | "opera/next", 101 | "safari/5.1..latest", 102 | "ipad/6.0..latest", 103 | "iphone/6.0..latest", 104 | "android-browser/4.2..latest" 105 | ], 106 | "files": "test/*.js" 107 | }, 108 | "version": "0.4.2" 109 | } 110 | -------------------------------------------------------------------------------- /node_modules/brace-expansion/README.md: -------------------------------------------------------------------------------- 1 | # brace-expansion 2 | 3 | [Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), 4 | as known from sh/bash, in JavaScript. 5 | 6 | [![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) 7 | [![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) 8 | [![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) 9 | 10 | [![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) 11 | 12 | ## Example 13 | 14 | ```js 15 | var expand = require('brace-expansion'); 16 | 17 | expand('file-{a,b,c}.jpg') 18 | // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] 19 | 20 | expand('-v{,,}') 21 | // => ['-v', '-v', '-v'] 22 | 23 | expand('file{0..2}.jpg') 24 | // => ['file0.jpg', 'file1.jpg', 'file2.jpg'] 25 | 26 | expand('file-{a..c}.jpg') 27 | // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] 28 | 29 | expand('file{2..0}.jpg') 30 | // => ['file2.jpg', 'file1.jpg', 'file0.jpg'] 31 | 32 | expand('file{0..4..2}.jpg') 33 | // => ['file0.jpg', 'file2.jpg', 'file4.jpg'] 34 | 35 | expand('file-{a..e..2}.jpg') 36 | // => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] 37 | 38 | expand('file{00..10..5}.jpg') 39 | // => ['file00.jpg', 'file05.jpg', 'file10.jpg'] 40 | 41 | expand('{{A..C},{a..c}}') 42 | // => ['A', 'B', 'C', 'a', 'b', 'c'] 43 | 44 | expand('ppp{,config,oe{,conf}}') 45 | // => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] 46 | ``` 47 | 48 | ## API 49 | 50 | ```js 51 | var expand = require('brace-expansion'); 52 | ``` 53 | 54 | ### var expanded = expand(str) 55 | 56 | Return an array of all possible and valid expansions of `str`. If none are 57 | found, `[str]` is returned. 58 | 59 | Valid expansions are: 60 | 61 | ```js 62 | /^(.*,)+(.+)?$/ 63 | // {a,b,...} 64 | ``` 65 | 66 | A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. 67 | 68 | ```js 69 | /^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ 70 | // {x..y[..incr]} 71 | ``` 72 | 73 | A numeric sequence from `x` to `y` inclusive, with optional increment. 74 | If `x` or `y` start with a leading `0`, all the numbers will be padded 75 | to have equal length. Negative numbers and backwards iteration work too. 76 | 77 | ```js 78 | /^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ 79 | // {x..y[..incr]} 80 | ``` 81 | 82 | An alphabetic sequence from `x` to `y` inclusive, with optional increment. 83 | `x` and `y` must be exactly one character, and if given, `incr` must be a 84 | number. 85 | 86 | For compatibility reasons, the string `${` is not eligible for brace expansion. 87 | 88 | ## Installation 89 | 90 | With [npm](https://npmjs.org) do: 91 | 92 | ```bash 93 | npm install brace-expansion 94 | ``` 95 | 96 | ## Contributors 97 | 98 | - [Julian Gruber](https://github.com/juliangruber) 99 | - [Isaac Z. Schlueter](https://github.com/isaacs) 100 | 101 | ## License 102 | 103 | (MIT) 104 | 105 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> 106 | 107 | Permission is hereby granted, free of charge, to any person obtaining a copy of 108 | this software and associated documentation files (the "Software"), to deal in 109 | the Software without restriction, including without limitation the rights to 110 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 111 | of the Software, and to permit persons to whom the Software is furnished to do 112 | so, subject to the following conditions: 113 | 114 | The above copyright notice and this permission notice shall be included in all 115 | copies or substantial portions of the Software. 116 | 117 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 118 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 119 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 120 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 121 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 122 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 123 | SOFTWARE. 124 | -------------------------------------------------------------------------------- /node_modules/brace-expansion/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "brace-expansion", 6 | "raw": "brace-expansion@^1.1.7", 7 | "rawSpec": "^1.1.7", 8 | "scope": null, 9 | "spec": ">=1.1.7 <2.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/minimatch" 13 | ] 14 | ], 15 | "_from": "brace-expansion@>=1.1.7 <2.0.0", 16 | "_id": "brace-expansion@1.1.7", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/brace-expansion", 20 | "_nodeVersion": "7.8.0", 21 | "_npmOperationalInternal": { 22 | "host": "packages-12-west.internal.npmjs.com", 23 | "tmp": "tmp/brace-expansion-1.1.7.tgz_1491552830231_0.7213963181711733" 24 | }, 25 | "_npmUser": { 26 | "email": "julian@juliangruber.com", 27 | "name": "juliangruber" 28 | }, 29 | "_npmVersion": "4.2.0", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "brace-expansion", 33 | "raw": "brace-expansion@^1.1.7", 34 | "rawSpec": "^1.1.7", 35 | "scope": null, 36 | "spec": ">=1.1.7 <2.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/minimatch" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", 43 | "_shasum": "3effc3c50e000531fb720eaff80f0ae8ef23cf59", 44 | "_shrinkwrap": null, 45 | "_spec": "brace-expansion@^1.1.7", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/minimatch", 47 | "author": { 48 | "email": "mail@juliangruber.com", 49 | "name": "Julian Gruber", 50 | "url": "http://juliangruber.com" 51 | }, 52 | "bugs": { 53 | "url": "https://github.com/juliangruber/brace-expansion/issues" 54 | }, 55 | "dependencies": { 56 | "balanced-match": "^0.4.1", 57 | "concat-map": "0.0.1" 58 | }, 59 | "description": "Brace expansion as known from sh/bash", 60 | "devDependencies": { 61 | "matcha": "^0.7.0", 62 | "tape": "^4.6.0" 63 | }, 64 | "directories": {}, 65 | "dist": { 66 | "shasum": "3effc3c50e000531fb720eaff80f0ae8ef23cf59", 67 | "tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz" 68 | }, 69 | "gitHead": "892512024872ca7680554be90f6e8ce065053372", 70 | "homepage": "https://github.com/juliangruber/brace-expansion", 71 | "keywords": [], 72 | "license": "MIT", 73 | "main": "index.js", 74 | "maintainers": [ 75 | { 76 | "email": "julian@juliangruber.com", 77 | "name": "juliangruber" 78 | }, 79 | { 80 | "email": "isaacs@npmjs.com", 81 | "name": "isaacs" 82 | } 83 | ], 84 | "name": "brace-expansion", 85 | "optionalDependencies": {}, 86 | "readme": "ERROR: No README data found!", 87 | "repository": { 88 | "type": "git", 89 | "url": "git://github.com/juliangruber/brace-expansion.git" 90 | }, 91 | "scripts": { 92 | "bench": "matcha test/perf/bench.js", 93 | "gentest": "bash test/generate.sh", 94 | "test": "tape test/*.js" 95 | }, 96 | "testling": { 97 | "browsers": [ 98 | "ie/8..latest", 99 | "firefox/20..latest", 100 | "firefox/nightly", 101 | "chrome/25..latest", 102 | "chrome/canary", 103 | "opera/12..latest", 104 | "opera/next", 105 | "safari/5.1..latest", 106 | "ipad/6.0..latest", 107 | "iphone/6.0..latest", 108 | "android-browser/4.2..latest" 109 | ], 110 | "files": "test/*.js" 111 | }, 112 | "version": "1.1.7" 113 | } 114 | -------------------------------------------------------------------------------- /node_modules/concat-map/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.4 4 | - 0.6 5 | -------------------------------------------------------------------------------- /node_modules/concat-map/LICENSE: -------------------------------------------------------------------------------- 1 | This software is released under the MIT license: 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /node_modules/concat-map/README.markdown: -------------------------------------------------------------------------------- 1 | concat-map 2 | ========== 3 | 4 | Concatenative mapdashery. 5 | 6 | [![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) 7 | 8 | [![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) 9 | 10 | example 11 | ======= 12 | 13 | ``` js 14 | var concatMap = require('concat-map'); 15 | var xs = [ 1, 2, 3, 4, 5, 6 ]; 16 | var ys = concatMap(xs, function (x) { 17 | return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; 18 | }); 19 | console.dir(ys); 20 | ``` 21 | 22 | *** 23 | 24 | ``` 25 | [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] 26 | ``` 27 | 28 | methods 29 | ======= 30 | 31 | ``` js 32 | var concatMap = require('concat-map') 33 | ``` 34 | 35 | concatMap(xs, fn) 36 | ----------------- 37 | 38 | Return an array of concatenated elements by calling `fn(x, i)` for each element 39 | `x` and each index `i` in the array `xs`. 40 | 41 | When `fn(x, i)` returns an array, its result will be concatenated with the 42 | result array. If `fn(x, i)` returns anything else, that value will be pushed 43 | onto the end of the result array. 44 | 45 | install 46 | ======= 47 | 48 | With [npm](http://npmjs.org) do: 49 | 50 | ``` 51 | npm install concat-map 52 | ``` 53 | 54 | license 55 | ======= 56 | 57 | MIT 58 | 59 | notes 60 | ===== 61 | 62 | This module was written while sitting high above the ground in a tree. 63 | -------------------------------------------------------------------------------- /node_modules/concat-map/example/map.js: -------------------------------------------------------------------------------- 1 | var concatMap = require('../'); 2 | var xs = [ 1, 2, 3, 4, 5, 6 ]; 3 | var ys = concatMap(xs, function (x) { 4 | return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; 5 | }); 6 | console.dir(ys); 7 | -------------------------------------------------------------------------------- /node_modules/concat-map/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function (xs, fn) { 2 | var res = []; 3 | for (var i = 0; i < xs.length; i++) { 4 | var x = fn(xs[i], i); 5 | if (isArray(x)) res.push.apply(res, x); 6 | else res.push(x); 7 | } 8 | return res; 9 | }; 10 | 11 | var isArray = Array.isArray || function (xs) { 12 | return Object.prototype.toString.call(xs) === '[object Array]'; 13 | }; 14 | -------------------------------------------------------------------------------- /node_modules/concat-map/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "concat-map", 6 | "raw": "concat-map@0.0.1", 7 | "rawSpec": "0.0.1", 8 | "scope": null, 9 | "spec": "0.0.1", 10 | "type": "version" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/brace-expansion" 13 | ] 14 | ], 15 | "_from": "concat-map@0.0.1", 16 | "_id": "concat-map@0.0.1", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/concat-map", 20 | "_npmUser": { 21 | "email": "mail@substack.net", 22 | "name": "substack" 23 | }, 24 | "_npmVersion": "1.3.21", 25 | "_phantomChildren": {}, 26 | "_requested": { 27 | "name": "concat-map", 28 | "raw": "concat-map@0.0.1", 29 | "rawSpec": "0.0.1", 30 | "scope": null, 31 | "spec": "0.0.1", 32 | "type": "version" 33 | }, 34 | "_requiredBy": [ 35 | "/brace-expansion" 36 | ], 37 | "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 38 | "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", 39 | "_shrinkwrap": null, 40 | "_spec": "concat-map@0.0.1", 41 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/brace-expansion", 42 | "author": { 43 | "email": "mail@substack.net", 44 | "name": "James Halliday", 45 | "url": "http://substack.net" 46 | }, 47 | "bugs": { 48 | "url": "https://github.com/substack/node-concat-map/issues" 49 | }, 50 | "dependencies": {}, 51 | "description": "concatenative mapdashery", 52 | "devDependencies": { 53 | "tape": "~2.4.0" 54 | }, 55 | "directories": { 56 | "example": "example", 57 | "test": "test" 58 | }, 59 | "dist": { 60 | "shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", 61 | "tarball": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" 62 | }, 63 | "homepage": "https://github.com/substack/node-concat-map", 64 | "keywords": [ 65 | "concat", 66 | "concatMap", 67 | "map", 68 | "functional", 69 | "higher-order" 70 | ], 71 | "license": "MIT", 72 | "main": "index.js", 73 | "maintainers": [ 74 | { 75 | "email": "mail@substack.net", 76 | "name": "substack" 77 | } 78 | ], 79 | "name": "concat-map", 80 | "optionalDependencies": {}, 81 | "readme": "ERROR: No README data found!", 82 | "repository": { 83 | "type": "git", 84 | "url": "git://github.com/substack/node-concat-map.git" 85 | }, 86 | "scripts": { 87 | "test": "tape test/*.js" 88 | }, 89 | "testling": { 90 | "browsers": { 91 | "chrome": [ 92 | 10, 93 | 22 94 | ], 95 | "ff": [ 96 | 3.5, 97 | 10, 98 | 15 99 | ], 100 | "ie": [ 101 | 6, 102 | 7, 103 | 8, 104 | 9 105 | ], 106 | "opera": [ 107 | 12 108 | ], 109 | "safari": [ 110 | 5.1 111 | ] 112 | }, 113 | "files": "test/*.js" 114 | }, 115 | "version": "0.0.1" 116 | } 117 | -------------------------------------------------------------------------------- /node_modules/concat-map/test/map.js: -------------------------------------------------------------------------------- 1 | var concatMap = require('../'); 2 | var test = require('tape'); 3 | 4 | test('empty or not', function (t) { 5 | var xs = [ 1, 2, 3, 4, 5, 6 ]; 6 | var ixes = []; 7 | var ys = concatMap(xs, function (x, ix) { 8 | ixes.push(ix); 9 | return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; 10 | }); 11 | t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); 12 | t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); 13 | t.end(); 14 | }); 15 | 16 | test('always something', function (t) { 17 | var xs = [ 'a', 'b', 'c', 'd' ]; 18 | var ys = concatMap(xs, function (x) { 19 | return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; 20 | }); 21 | t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); 22 | t.end(); 23 | }); 24 | 25 | test('scalars', function (t) { 26 | var xs = [ 'a', 'b', 'c', 'd' ]; 27 | var ys = concatMap(xs, function (x) { 28 | return x === 'b' ? [ 'B', 'B', 'B' ] : x; 29 | }); 30 | t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); 31 | t.end(); 32 | }); 33 | 34 | test('undefs', function (t) { 35 | var xs = [ 'a', 'b', 'c', 'd' ]; 36 | var ys = concatMap(xs, function () {}); 37 | t.same(ys, [ undefined, undefined, undefined, undefined ]); 38 | t.end(); 39 | }); 40 | -------------------------------------------------------------------------------- /node_modules/exit/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": "nofunc", 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "unused": true, 11 | "boss": true, 12 | "eqnull": true, 13 | "node": true 14 | } 15 | -------------------------------------------------------------------------------- /node_modules/exit/.npmignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/souiukoto/javascript-test-generator/01b267999b1b9a47675a89de95c3383454d3a561/node_modules/exit/.npmignore -------------------------------------------------------------------------------- /node_modules/exit/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.8 4 | - '0.10' 5 | before_script: 6 | - npm install -g grunt-cli 7 | -------------------------------------------------------------------------------- /node_modules/exit/Gruntfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(grunt) { 4 | 5 | // Project configuration. 6 | grunt.initConfig({ 7 | nodeunit: { 8 | files: ['test/**/*_test.js'], 9 | }, 10 | jshint: { 11 | options: { 12 | jshintrc: '.jshintrc' 13 | }, 14 | gruntfile: { 15 | src: 'Gruntfile.js' 16 | }, 17 | lib: { 18 | src: ['lib/**/*.js'] 19 | }, 20 | test: { 21 | src: ['test/**/*.js'] 22 | }, 23 | }, 24 | watch: { 25 | gruntfile: { 26 | files: '<%= jshint.gruntfile.src %>', 27 | tasks: ['jshint:gruntfile'] 28 | }, 29 | lib: { 30 | files: '<%= jshint.lib.src %>', 31 | tasks: ['jshint:lib', 'nodeunit'] 32 | }, 33 | test: { 34 | files: '<%= jshint.test.src %>', 35 | tasks: ['jshint:test', 'nodeunit'] 36 | }, 37 | }, 38 | }); 39 | 40 | // These plugins provide necessary tasks. 41 | grunt.loadNpmTasks('grunt-contrib-nodeunit'); 42 | grunt.loadNpmTasks('grunt-contrib-jshint'); 43 | grunt.loadNpmTasks('grunt-contrib-watch'); 44 | 45 | // Default task. 46 | grunt.registerTask('default', ['jshint', 'nodeunit']); 47 | 48 | }; 49 | -------------------------------------------------------------------------------- /node_modules/exit/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 "Cowboy" Ben Alman 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /node_modules/exit/README.md: -------------------------------------------------------------------------------- 1 | # exit [![Build Status](https://secure.travis-ci.org/cowboy/node-exit.png?branch=master)](http://travis-ci.org/cowboy/node-exit) 2 | 3 | A replacement for process.exit that ensures stdio are fully drained before exiting. 4 | 5 | To make a long story short, if `process.exit` is called on Windows, script output is often truncated when pipe-redirecting `stdout` or `stderr`. This module attempts to work around this issue by waiting until those streams have been completely drained before actually calling `process.exit`. 6 | 7 | See [Node.js issue #3584](https://github.com/joyent/node/issues/3584) for further reference. 8 | 9 | Tested in OS X 10.8, Windows 7 on Node.js 0.8.25 and 0.10.18. 10 | 11 | Based on some code by [@vladikoff](https://github.com/vladikoff). 12 | 13 | ## Getting Started 14 | Install the module with: `npm install exit` 15 | 16 | ```javascript 17 | var exit = require('exit'); 18 | 19 | // These lines should appear in the output, EVEN ON WINDOWS. 20 | console.log("omg"); 21 | console.error("yay"); 22 | 23 | // process.exit(5); 24 | exit(5); 25 | 26 | // These lines shouldn't appear in the output. 27 | console.log("wtf"); 28 | console.error("bro"); 29 | ``` 30 | 31 | ## Don't believe me? Try it for yourself. 32 | 33 | In Windows, clone the repo and cd to the `test\fixtures` directory. The only difference between [log.js](test/fixtures/log.js) and [log-broken.js](test/fixtures/log-broken.js) is that the former uses `exit` while the latter calls `process.exit` directly. 34 | 35 | This test was done using cmd.exe, but you can see the same results using `| grep "std"` in either PowerShell or git-bash. 36 | 37 | ``` 38 | C:\node-exit\test\fixtures>node log.js 0 10 stdout stderr 2>&1 | find "std" 39 | stdout 0 40 | stderr 0 41 | stdout 1 42 | stderr 1 43 | stdout 2 44 | stderr 2 45 | stdout 3 46 | stderr 3 47 | stdout 4 48 | stderr 4 49 | stdout 5 50 | stderr 5 51 | stdout 6 52 | stderr 6 53 | stdout 7 54 | stderr 7 55 | stdout 8 56 | stderr 8 57 | stdout 9 58 | stderr 9 59 | 60 | C:\node-exit\test\fixtures>node log-broken.js 0 10 stdout stderr 2>&1 | find "std" 61 | 62 | C:\node-exit\test\fixtures> 63 | ``` 64 | 65 | ## Contributing 66 | In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). 67 | 68 | ## Release History 69 | 2013-11-26 - v0.1.2 - Fixed a bug with hanging processes. 70 | 2013-09-26 - v0.1.1 - Fixed some bugs. It seems to actually work now! 71 | 2013-09-20 - v0.1.0 - Initial release. 72 | 73 | ## License 74 | Copyright (c) 2013 "Cowboy" Ben Alman 75 | Licensed under the MIT license. 76 | -------------------------------------------------------------------------------- /node_modules/exit/lib/exit.js: -------------------------------------------------------------------------------- 1 | /* 2 | * exit 3 | * https://github.com/cowboy/node-exit 4 | * 5 | * Copyright (c) 2013 "Cowboy" Ben Alman 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | module.exports = function exit(exitCode, streams) { 12 | if (!streams) { streams = [process.stdout, process.stderr]; } 13 | var drainCount = 0; 14 | // Actually exit if all streams are drained. 15 | function tryToExit() { 16 | if (drainCount === streams.length) { 17 | process.exit(exitCode); 18 | } 19 | } 20 | streams.forEach(function(stream) { 21 | // Count drained streams now, but monitor non-drained streams. 22 | if (stream.bufferSize === 0) { 23 | drainCount++; 24 | } else { 25 | stream.write('', 'utf-8', function() { 26 | drainCount++; 27 | tryToExit(); 28 | }); 29 | } 30 | // Prevent further writing. 31 | stream.write = function() {}; 32 | }); 33 | // If all streams were already drained, exit now. 34 | tryToExit(); 35 | // In Windows, when run as a Node.js child process, a script utilizing 36 | // this library might just exit with a 0 exit code, regardless. This code, 37 | // despite the fact that it looks a bit crazy, appears to fix that. 38 | process.on('exit', function() { 39 | process.exit(exitCode); 40 | }); 41 | }; 42 | -------------------------------------------------------------------------------- /node_modules/exit/test/exit_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* 4 | ======== A Handy Little Nodeunit Reference ======== 5 | https://github.com/caolan/nodeunit 6 | 7 | Test methods: 8 | test.expect(numAssertions) 9 | test.done() 10 | Test assertions: 11 | test.ok(value, [message]) 12 | test.equal(actual, expected, [message]) 13 | test.notEqual(actual, expected, [message]) 14 | test.deepEqual(actual, expected, [message]) 15 | test.notDeepEqual(actual, expected, [message]) 16 | test.strictEqual(actual, expected, [message]) 17 | test.notStrictEqual(actual, expected, [message]) 18 | test.throws(block, [error], [message]) 19 | test.doesNotThrow(block, [error], [message]) 20 | test.ifError(value) 21 | */ 22 | 23 | var fs = require('fs'); 24 | var exec = require('child_process').exec; 25 | 26 | var _which = require('which').sync; 27 | function which(command) { 28 | try { 29 | _which(command); 30 | return command; 31 | } catch (err) { 32 | return false; 33 | } 34 | } 35 | 36 | // Look for grep first (any OS). If not found (but on Windows) look for find, 37 | // which is Windows' horribly crippled grep alternative. 38 | var grep = which('grep') || process.platform === 'win32' && which('find'); 39 | 40 | exports['exit'] = { 41 | setUp: function(done) { 42 | this.origCwd = process.cwd(); 43 | process.chdir('test/fixtures'); 44 | done(); 45 | }, 46 | tearDown: function(done) { 47 | process.chdir(this.origCwd); 48 | done(); 49 | }, 50 | 'grep': function(test) { 51 | test.expect(1); 52 | // Many unit tests depend on this. 53 | test.ok(grep, 'A suitable "grep" or "find" program was not found in the PATH.'); 54 | test.done(); 55 | }, 56 | // The rest of the tests are built dynamically, to keep things sane. 57 | }; 58 | 59 | // A few helper functions. 60 | function normalizeLineEndings(s) { 61 | return s.replace(/\r?\n/g, '\n'); 62 | } 63 | 64 | // Capture command output, normalizing captured stdout to unix file endings. 65 | function run(command, callback) { 66 | exec(command, function(error, stdout) { 67 | callback(error ? error.code : 0, normalizeLineEndings(stdout)); 68 | }); 69 | } 70 | 71 | // Read a fixture file, normalizing file contents to unix file endings. 72 | function fixture(filename) { 73 | return normalizeLineEndings(String(fs.readFileSync(filename))); 74 | } 75 | 76 | function buildTests() { 77 | // Build individual unit tests for command output. 78 | var counts = [10, 100, 1000]; 79 | var outputs = [' stdout stderr', ' stdout', ' stderr']; 80 | var pipes = ['', ' | ' + grep + ' "std"']; 81 | counts.forEach(function(count) { 82 | outputs.forEach(function(output) { 83 | pipes.forEach(function(pipe) { 84 | var command = 'node log.js 0 ' + count + output + ' 2>&1' + pipe; 85 | exports['exit']['output (' + command + ')'] = function(test) { 86 | test.expect(2); 87 | run(command, function(code, actual) { 88 | var expected = fixture(count + output.replace(/ /g, '-') + '.txt'); 89 | // Sometimes, the actual file lines are out of order on Windows. 90 | // But since the point of this lib is to drain the buffer and not 91 | // guarantee output order, we only test the length. 92 | test.equal(actual.length, expected.length, 'should be the same length.'); 93 | // The "fail" lines in log.js should NOT be output! 94 | test.ok(actual.indexOf('fail') === -1, 'should not output after exit is called.'); 95 | test.done(); 96 | }); 97 | }; 98 | }); 99 | }); 100 | }); 101 | 102 | // Build individual unit tests for exit codes. 103 | var codes = [0, 1, 123]; 104 | codes.forEach(function(code) { 105 | var command = 'node log.js ' + code + ' 10 stdout stderr'; 106 | exports['exit']['exit code (' + command + ')'] = function(test) { 107 | test.expect(1); 108 | run(command, function(actual) { 109 | // The specified exit code should be passed through. 110 | test.equal(actual, code, 'should exit with ' + code + ' error code.'); 111 | test.done(); 112 | }); 113 | }; 114 | }); 115 | } 116 | 117 | // Don't bother building tests if grep wasn't found, otherwise everything will 118 | // fail and the error will get lost. 119 | if (grep) { 120 | buildTests(); 121 | } 122 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/10-stderr.txt: -------------------------------------------------------------------------------- 1 | stderr 0 2 | stderr 1 3 | stderr 2 4 | stderr 3 5 | stderr 4 6 | stderr 5 7 | stderr 6 8 | stderr 7 9 | stderr 8 10 | stderr 9 11 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/10-stdout-stderr.txt: -------------------------------------------------------------------------------- 1 | stdout 0 2 | stderr 0 3 | stdout 1 4 | stdout 2 5 | stderr 1 6 | stdout 3 7 | stderr 2 8 | stderr 3 9 | stdout 4 10 | stderr 4 11 | stdout 5 12 | stderr 5 13 | stdout 6 14 | stderr 6 15 | stdout 7 16 | stderr 7 17 | stdout 8 18 | stderr 8 19 | stdout 9 20 | stderr 9 21 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/10-stdout.txt: -------------------------------------------------------------------------------- 1 | stdout 0 2 | stdout 1 3 | stdout 2 4 | stdout 3 5 | stdout 4 6 | stdout 5 7 | stdout 6 8 | stdout 7 9 | stdout 8 10 | stdout 9 11 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/100-stderr.txt: -------------------------------------------------------------------------------- 1 | stderr 0 2 | stderr 1 3 | stderr 2 4 | stderr 3 5 | stderr 4 6 | stderr 5 7 | stderr 6 8 | stderr 7 9 | stderr 8 10 | stderr 9 11 | stderr 10 12 | stderr 11 13 | stderr 12 14 | stderr 13 15 | stderr 14 16 | stderr 15 17 | stderr 16 18 | stderr 17 19 | stderr 18 20 | stderr 19 21 | stderr 20 22 | stderr 21 23 | stderr 22 24 | stderr 23 25 | stderr 24 26 | stderr 25 27 | stderr 26 28 | stderr 27 29 | stderr 28 30 | stderr 29 31 | stderr 30 32 | stderr 31 33 | stderr 32 34 | stderr 33 35 | stderr 34 36 | stderr 35 37 | stderr 36 38 | stderr 37 39 | stderr 38 40 | stderr 39 41 | stderr 40 42 | stderr 41 43 | stderr 42 44 | stderr 43 45 | stderr 44 46 | stderr 45 47 | stderr 46 48 | stderr 47 49 | stderr 48 50 | stderr 49 51 | stderr 50 52 | stderr 51 53 | stderr 52 54 | stderr 53 55 | stderr 54 56 | stderr 55 57 | stderr 56 58 | stderr 57 59 | stderr 58 60 | stderr 59 61 | stderr 60 62 | stderr 61 63 | stderr 62 64 | stderr 63 65 | stderr 64 66 | stderr 65 67 | stderr 66 68 | stderr 67 69 | stderr 68 70 | stderr 69 71 | stderr 70 72 | stderr 71 73 | stderr 72 74 | stderr 73 75 | stderr 74 76 | stderr 75 77 | stderr 76 78 | stderr 77 79 | stderr 78 80 | stderr 79 81 | stderr 80 82 | stderr 81 83 | stderr 82 84 | stderr 83 85 | stderr 84 86 | stderr 85 87 | stderr 86 88 | stderr 87 89 | stderr 88 90 | stderr 89 91 | stderr 90 92 | stderr 91 93 | stderr 92 94 | stderr 93 95 | stderr 94 96 | stderr 95 97 | stderr 96 98 | stderr 97 99 | stderr 98 100 | stderr 99 101 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/100-stdout-stderr.txt: -------------------------------------------------------------------------------- 1 | stdout 0 2 | stderr 0 3 | stdout 1 4 | stderr 1 5 | stdout 2 6 | stderr 2 7 | stdout 3 8 | stderr 3 9 | stdout 4 10 | stderr 4 11 | stdout 5 12 | stderr 5 13 | stdout 6 14 | stderr 6 15 | stdout 7 16 | stderr 7 17 | stdout 8 18 | stderr 8 19 | stdout 9 20 | stderr 9 21 | stdout 10 22 | stderr 10 23 | stdout 11 24 | stderr 11 25 | stdout 12 26 | stderr 12 27 | stdout 13 28 | stderr 13 29 | stdout 14 30 | stderr 14 31 | stdout 15 32 | stderr 15 33 | stdout 16 34 | stderr 16 35 | stdout 17 36 | stderr 17 37 | stdout 18 38 | stderr 18 39 | stdout 19 40 | stderr 19 41 | stdout 20 42 | stderr 20 43 | stdout 21 44 | stderr 21 45 | stdout 22 46 | stderr 22 47 | stdout 23 48 | stderr 23 49 | stdout 24 50 | stderr 24 51 | stdout 25 52 | stderr 25 53 | stdout 26 54 | stderr 26 55 | stdout 27 56 | stderr 27 57 | stdout 28 58 | stderr 28 59 | stdout 29 60 | stderr 29 61 | stdout 30 62 | stderr 30 63 | stdout 31 64 | stderr 31 65 | stdout 32 66 | stderr 32 67 | stdout 33 68 | stderr 33 69 | stdout 34 70 | stderr 34 71 | stdout 35 72 | stderr 35 73 | stdout 36 74 | stderr 36 75 | stdout 37 76 | stderr 37 77 | stdout 38 78 | stderr 38 79 | stdout 39 80 | stderr 39 81 | stdout 40 82 | stderr 40 83 | stdout 41 84 | stderr 41 85 | stdout 42 86 | stderr 42 87 | stdout 43 88 | stderr 43 89 | stdout 44 90 | stderr 44 91 | stdout 45 92 | stderr 45 93 | stdout 46 94 | stderr 46 95 | stdout 47 96 | stderr 47 97 | stdout 48 98 | stderr 48 99 | stdout 49 100 | stderr 49 101 | stdout 50 102 | stderr 50 103 | stdout 51 104 | stderr 51 105 | stdout 52 106 | stderr 52 107 | stdout 53 108 | stderr 53 109 | stdout 54 110 | stderr 54 111 | stdout 55 112 | stderr 55 113 | stdout 56 114 | stderr 56 115 | stdout 57 116 | stderr 57 117 | stdout 58 118 | stderr 58 119 | stdout 59 120 | stderr 59 121 | stdout 60 122 | stderr 60 123 | stdout 61 124 | stderr 61 125 | stdout 62 126 | stderr 62 127 | stdout 63 128 | stderr 63 129 | stdout 64 130 | stderr 64 131 | stdout 65 132 | stderr 65 133 | stdout 66 134 | stderr 66 135 | stdout 67 136 | stderr 67 137 | stdout 68 138 | stderr 68 139 | stdout 69 140 | stderr 69 141 | stdout 70 142 | stderr 70 143 | stdout 71 144 | stderr 71 145 | stdout 72 146 | stderr 72 147 | stdout 73 148 | stderr 73 149 | stdout 74 150 | stderr 74 151 | stdout 75 152 | stderr 75 153 | stdout 76 154 | stderr 76 155 | stdout 77 156 | stderr 77 157 | stdout 78 158 | stderr 78 159 | stdout 79 160 | stderr 79 161 | stdout 80 162 | stderr 80 163 | stdout 81 164 | stderr 81 165 | stdout 82 166 | stderr 82 167 | stdout 83 168 | stderr 83 169 | stdout 84 170 | stderr 84 171 | stdout 85 172 | stderr 85 173 | stdout 86 174 | stderr 86 175 | stdout 87 176 | stderr 87 177 | stdout 88 178 | stderr 88 179 | stdout 89 180 | stderr 89 181 | stdout 90 182 | stderr 90 183 | stdout 91 184 | stderr 91 185 | stdout 92 186 | stderr 92 187 | stdout 93 188 | stderr 93 189 | stdout 94 190 | stderr 94 191 | stdout 95 192 | stderr 95 193 | stdout 96 194 | stderr 96 195 | stdout 97 196 | stderr 97 197 | stdout 98 198 | stderr 98 199 | stdout 99 200 | stderr 99 201 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/100-stdout.txt: -------------------------------------------------------------------------------- 1 | stdout 0 2 | stdout 1 3 | stdout 2 4 | stdout 3 5 | stdout 4 6 | stdout 5 7 | stdout 6 8 | stdout 7 9 | stdout 8 10 | stdout 9 11 | stdout 10 12 | stdout 11 13 | stdout 12 14 | stdout 13 15 | stdout 14 16 | stdout 15 17 | stdout 16 18 | stdout 17 19 | stdout 18 20 | stdout 19 21 | stdout 20 22 | stdout 21 23 | stdout 22 24 | stdout 23 25 | stdout 24 26 | stdout 25 27 | stdout 26 28 | stdout 27 29 | stdout 28 30 | stdout 29 31 | stdout 30 32 | stdout 31 33 | stdout 32 34 | stdout 33 35 | stdout 34 36 | stdout 35 37 | stdout 36 38 | stdout 37 39 | stdout 38 40 | stdout 39 41 | stdout 40 42 | stdout 41 43 | stdout 42 44 | stdout 43 45 | stdout 44 46 | stdout 45 47 | stdout 46 48 | stdout 47 49 | stdout 48 50 | stdout 49 51 | stdout 50 52 | stdout 51 53 | stdout 52 54 | stdout 53 55 | stdout 54 56 | stdout 55 57 | stdout 56 58 | stdout 57 59 | stdout 58 60 | stdout 59 61 | stdout 60 62 | stdout 61 63 | stdout 62 64 | stdout 63 65 | stdout 64 66 | stdout 65 67 | stdout 66 68 | stdout 67 69 | stdout 68 70 | stdout 69 71 | stdout 70 72 | stdout 71 73 | stdout 72 74 | stdout 73 75 | stdout 74 76 | stdout 75 77 | stdout 76 78 | stdout 77 79 | stdout 78 80 | stdout 79 81 | stdout 80 82 | stdout 81 83 | stdout 82 84 | stdout 83 85 | stdout 84 86 | stdout 85 87 | stdout 86 88 | stdout 87 89 | stdout 88 90 | stdout 89 91 | stdout 90 92 | stdout 91 93 | stdout 92 94 | stdout 93 95 | stdout 94 96 | stdout 95 97 | stdout 96 98 | stdout 97 99 | stdout 98 100 | stdout 99 101 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/create-files.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | rm 10*.txt 4 | for n in 10 100 1000; do 5 | node log.js 0 $n stdout stderr &> $n-stdout-stderr.txt 6 | node log.js 0 $n stdout &> $n-stdout.txt 7 | node log.js 0 $n stderr &> $n-stderr.txt 8 | done 9 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/log-broken.js: -------------------------------------------------------------------------------- 1 | var errorCode = process.argv[2]; 2 | var max = process.argv[3]; 3 | var modes = process.argv.slice(4); 4 | 5 | function stdout(message) { 6 | if (modes.indexOf('stdout') === -1) { return; } 7 | process.stdout.write('stdout ' + message + '\n'); 8 | } 9 | 10 | function stderr(message) { 11 | if (modes.indexOf('stderr') === -1) { return; } 12 | process.stderr.write('stderr ' + message + '\n'); 13 | } 14 | 15 | for (var i = 0; i < max; i++) { 16 | stdout(i); 17 | stderr(i); 18 | } 19 | 20 | process.exit(errorCode); 21 | 22 | stdout('fail'); 23 | stderr('fail'); 24 | -------------------------------------------------------------------------------- /node_modules/exit/test/fixtures/log.js: -------------------------------------------------------------------------------- 1 | var exit = require('../../lib/exit'); 2 | 3 | var errorCode = process.argv[2]; 4 | var max = process.argv[3]; 5 | var modes = process.argv.slice(4); 6 | 7 | function stdout(message) { 8 | if (modes.indexOf('stdout') === -1) { return; } 9 | process.stdout.write('stdout ' + message + '\n'); 10 | } 11 | 12 | function stderr(message) { 13 | if (modes.indexOf('stderr') === -1) { return; } 14 | process.stderr.write('stderr ' + message + '\n'); 15 | } 16 | 17 | for (var i = 0; i < max; i++) { 18 | stdout(i); 19 | stderr(i); 20 | } 21 | 22 | exit(errorCode); 23 | 24 | stdout('fail'); 25 | stderr('fail'); 26 | -------------------------------------------------------------------------------- /node_modules/fs.realpath/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter and Contributors 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | ---- 18 | 19 | This library bundles a version of the `fs.realpath` and `fs.realpathSync` 20 | methods from Node.js v0.10 under the terms of the Node.js MIT license. 21 | 22 | Node's license follows, also included at the header of `old.js` which contains 23 | the licensed code: 24 | 25 | Copyright Joyent, Inc. and other Node contributors. 26 | 27 | Permission is hereby granted, free of charge, to any person obtaining a 28 | copy of this software and associated documentation files (the "Software"), 29 | to deal in the Software without restriction, including without limitation 30 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 31 | and/or sell copies of the Software, and to permit persons to whom the 32 | Software is furnished to do so, subject to the following conditions: 33 | 34 | The above copyright notice and this permission notice shall be included in 35 | all copies or substantial portions of the Software. 36 | 37 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 38 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 39 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 40 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 41 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 42 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 43 | DEALINGS IN THE SOFTWARE. 44 | -------------------------------------------------------------------------------- /node_modules/fs.realpath/README.md: -------------------------------------------------------------------------------- 1 | # fs.realpath 2 | 3 | A backwards-compatible fs.realpath for Node v6 and above 4 | 5 | In Node v6, the JavaScript implementation of fs.realpath was replaced 6 | with a faster (but less resilient) native implementation. That raises 7 | new and platform-specific errors and cannot handle long or excessively 8 | symlink-looping paths. 9 | 10 | This module handles those cases by detecting the new errors and 11 | falling back to the JavaScript implementation. On versions of Node 12 | prior to v6, it has no effect. 13 | 14 | ## USAGE 15 | 16 | ```js 17 | var rp = require('fs.realpath') 18 | 19 | // async version 20 | rp.realpath(someLongAndLoopingPath, function (er, real) { 21 | // the ELOOP was handled, but it was a bit slower 22 | }) 23 | 24 | // sync version 25 | var real = rp.realpathSync(someLongAndLoopingPath) 26 | 27 | // monkeypatch at your own risk! 28 | // This replaces the fs.realpath/fs.realpathSync builtins 29 | rp.monkeypatch() 30 | 31 | // un-do the monkeypatching 32 | rp.unmonkeypatch() 33 | ``` 34 | -------------------------------------------------------------------------------- /node_modules/fs.realpath/index.js: -------------------------------------------------------------------------------- 1 | module.exports = realpath 2 | realpath.realpath = realpath 3 | realpath.sync = realpathSync 4 | realpath.realpathSync = realpathSync 5 | realpath.monkeypatch = monkeypatch 6 | realpath.unmonkeypatch = unmonkeypatch 7 | 8 | var fs = require('fs') 9 | var origRealpath = fs.realpath 10 | var origRealpathSync = fs.realpathSync 11 | 12 | var version = process.version 13 | var ok = /^v[0-5]\./.test(version) 14 | var old = require('./old.js') 15 | 16 | function newError (er) { 17 | return er && er.syscall === 'realpath' && ( 18 | er.code === 'ELOOP' || 19 | er.code === 'ENOMEM' || 20 | er.code === 'ENAMETOOLONG' 21 | ) 22 | } 23 | 24 | function realpath (p, cache, cb) { 25 | if (ok) { 26 | return origRealpath(p, cache, cb) 27 | } 28 | 29 | if (typeof cache === 'function') { 30 | cb = cache 31 | cache = null 32 | } 33 | origRealpath(p, cache, function (er, result) { 34 | if (newError(er)) { 35 | old.realpath(p, cache, cb) 36 | } else { 37 | cb(er, result) 38 | } 39 | }) 40 | } 41 | 42 | function realpathSync (p, cache) { 43 | if (ok) { 44 | return origRealpathSync(p, cache) 45 | } 46 | 47 | try { 48 | return origRealpathSync(p, cache) 49 | } catch (er) { 50 | if (newError(er)) { 51 | return old.realpathSync(p, cache) 52 | } else { 53 | throw er 54 | } 55 | } 56 | } 57 | 58 | function monkeypatch () { 59 | fs.realpath = realpath 60 | fs.realpathSync = realpathSync 61 | } 62 | 63 | function unmonkeypatch () { 64 | fs.realpath = origRealpath 65 | fs.realpathSync = origRealpathSync 66 | } 67 | -------------------------------------------------------------------------------- /node_modules/fs.realpath/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "fs.realpath", 6 | "raw": "fs.realpath@^1.0.0", 7 | "rawSpec": "^1.0.0", 8 | "scope": null, 9 | "spec": ">=1.0.0 <2.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob" 13 | ] 14 | ], 15 | "_from": "fs.realpath@>=1.0.0 <2.0.0", 16 | "_id": "fs.realpath@1.0.0", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/fs.realpath", 20 | "_nodeVersion": "4.4.4", 21 | "_npmOperationalInternal": { 22 | "host": "packages-16-east.internal.npmjs.com", 23 | "tmp": "tmp/fs.realpath-1.0.0.tgz_1466015941059_0.3332864767871797" 24 | }, 25 | "_npmUser": { 26 | "email": "i@izs.me", 27 | "name": "isaacs" 28 | }, 29 | "_npmVersion": "3.9.1", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "fs.realpath", 33 | "raw": "fs.realpath@^1.0.0", 34 | "rawSpec": "^1.0.0", 35 | "scope": null, 36 | "spec": ">=1.0.0 <2.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/glob" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 43 | "_shasum": "1504ad2523158caa40db4a2787cb01411994ea4f", 44 | "_shrinkwrap": null, 45 | "_spec": "fs.realpath@^1.0.0", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob", 47 | "author": { 48 | "email": "i@izs.me", 49 | "name": "Isaac Z. Schlueter", 50 | "url": "http://blog.izs.me/" 51 | }, 52 | "bugs": { 53 | "url": "https://github.com/isaacs/fs.realpath/issues" 54 | }, 55 | "dependencies": {}, 56 | "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", 57 | "devDependencies": {}, 58 | "directories": {}, 59 | "dist": { 60 | "shasum": "1504ad2523158caa40db4a2787cb01411994ea4f", 61 | "tarball": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" 62 | }, 63 | "files": [ 64 | "old.js", 65 | "index.js" 66 | ], 67 | "gitHead": "03e7c884431fe185dfebbc9b771aeca339c1807a", 68 | "homepage": "https://github.com/isaacs/fs.realpath#readme", 69 | "keywords": [ 70 | "realpath", 71 | "fs", 72 | "polyfill" 73 | ], 74 | "license": "ISC", 75 | "main": "index.js", 76 | "maintainers": [ 77 | { 78 | "email": "i@izs.me", 79 | "name": "isaacs" 80 | } 81 | ], 82 | "name": "fs.realpath", 83 | "optionalDependencies": {}, 84 | "readme": "ERROR: No README data found!", 85 | "repository": { 86 | "type": "git", 87 | "url": "git+https://github.com/isaacs/fs.realpath.git" 88 | }, 89 | "scripts": { 90 | "test": "tap test/*.js --cov" 91 | }, 92 | "version": "1.0.0" 93 | } 94 | -------------------------------------------------------------------------------- /node_modules/glob/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter and Contributors 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /node_modules/glob/changelog.md: -------------------------------------------------------------------------------- 1 | ## 7.0 2 | 3 | - Raise error if `options.cwd` is specified, and not a directory 4 | 5 | ## 6.0 6 | 7 | - Remove comment and negation pattern support 8 | - Ignore patterns are always in `dot:true` mode 9 | 10 | ## 5.0 11 | 12 | - Deprecate comment and negation patterns 13 | - Fix regression in `mark` and `nodir` options from making all cache 14 | keys absolute path. 15 | - Abort if `fs.readdir` returns an error that's unexpected 16 | - Don't emit `match` events for ignored items 17 | - Treat ENOTSUP like ENOTDIR in readdir 18 | 19 | ## 4.5 20 | 21 | - Add `options.follow` to always follow directory symlinks in globstar 22 | - Add `options.realpath` to call `fs.realpath` on all results 23 | - Always cache based on absolute path 24 | 25 | ## 4.4 26 | 27 | - Add `options.ignore` 28 | - Fix handling of broken symlinks 29 | 30 | ## 4.3 31 | 32 | - Bump minimatch to 2.x 33 | - Pass all tests on Windows 34 | 35 | ## 4.2 36 | 37 | - Add `glob.hasMagic` function 38 | - Add `options.nodir` flag 39 | 40 | ## 4.1 41 | 42 | - Refactor sync and async implementations for performance 43 | - Throw if callback provided to sync glob function 44 | - Treat symbolic links in globstar results the same as Bash 4.3 45 | 46 | ## 4.0 47 | 48 | - Use `^` for dependency versions (bumped major because this breaks 49 | older npm versions) 50 | - Ensure callbacks are only ever called once 51 | - switch to ISC license 52 | 53 | ## 3.x 54 | 55 | - Rewrite in JavaScript 56 | - Add support for setting root, cwd, and windows support 57 | - Cache many fs calls 58 | - Add globstar support 59 | - emit match events 60 | 61 | ## 2.x 62 | 63 | - Use `glob.h` and `fnmatch.h` from NetBSD 64 | 65 | ## 1.x 66 | 67 | - `glob.h` static binding. 68 | -------------------------------------------------------------------------------- /node_modules/glob/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "glob", 6 | "raw": "glob@^7.0.6", 7 | "rawSpec": "^7.0.6", 8 | "scope": null, 9 | "spec": ">=7.0.6 <8.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/jasmine" 13 | ] 14 | ], 15 | "_from": "glob@>=7.0.6 <8.0.0", 16 | "_id": "glob@7.1.2", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/glob", 20 | "_nodeVersion": "8.0.0-pre", 21 | "_npmOperationalInternal": { 22 | "host": "s3://npm-registry-packages", 23 | "tmp": "tmp/glob-7.1.2.tgz_1495224925341_0.07115248567424715" 24 | }, 25 | "_npmUser": { 26 | "email": "i@izs.me", 27 | "name": "isaacs" 28 | }, 29 | "_npmVersion": "5.0.0-beta.56", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "glob", 33 | "raw": "glob@^7.0.6", 34 | "rawSpec": "^7.0.6", 35 | "scope": null, 36 | "spec": ">=7.0.6 <8.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/jasmine" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", 43 | "_shasum": "c19c9df9a028702d678612384a6552404c636d15", 44 | "_shrinkwrap": null, 45 | "_spec": "glob@^7.0.6", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/jasmine", 47 | "author": { 48 | "email": "i@izs.me", 49 | "name": "Isaac Z. Schlueter", 50 | "url": "http://blog.izs.me/" 51 | }, 52 | "bugs": { 53 | "url": "https://github.com/isaacs/node-glob/issues" 54 | }, 55 | "dependencies": { 56 | "fs.realpath": "^1.0.0", 57 | "inflight": "^1.0.4", 58 | "inherits": "2", 59 | "minimatch": "^3.0.4", 60 | "once": "^1.3.0", 61 | "path-is-absolute": "^1.0.0" 62 | }, 63 | "description": "a little globber", 64 | "devDependencies": { 65 | "mkdirp": "0", 66 | "rimraf": "^2.2.8", 67 | "tap": "^7.1.2", 68 | "tick": "0.0.6" 69 | }, 70 | "directories": {}, 71 | "dist": { 72 | "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", 73 | "shasum": "c19c9df9a028702d678612384a6552404c636d15", 74 | "tarball": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz" 75 | }, 76 | "engines": { 77 | "node": "*" 78 | }, 79 | "files": [ 80 | "glob.js", 81 | "sync.js", 82 | "common.js" 83 | ], 84 | "gitHead": "8fa8d561e08c9eed1d286c6a35be2cd8123b2fb7", 85 | "homepage": "https://github.com/isaacs/node-glob#readme", 86 | "license": "ISC", 87 | "main": "glob.js", 88 | "maintainers": [ 89 | { 90 | "email": "i@izs.me", 91 | "name": "isaacs" 92 | } 93 | ], 94 | "name": "glob", 95 | "optionalDependencies": {}, 96 | "readme": "ERROR: No README data found!", 97 | "repository": { 98 | "type": "git", 99 | "url": "git://github.com/isaacs/node-glob.git" 100 | }, 101 | "scripts": { 102 | "bench": "bash benchmark.sh", 103 | "benchclean": "node benchclean.js", 104 | "prepublish": "npm run benchclean", 105 | "prof": "bash prof.sh && cat profile.txt", 106 | "profclean": "rm -f v8.log profile.txt", 107 | "test": "tap test/*.js --cov", 108 | "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" 109 | }, 110 | "version": "7.1.2" 111 | } 112 | -------------------------------------------------------------------------------- /node_modules/inflight/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /node_modules/inflight/README.md: -------------------------------------------------------------------------------- 1 | # inflight 2 | 3 | Add callbacks to requests in flight to avoid async duplication 4 | 5 | ## USAGE 6 | 7 | ```javascript 8 | var inflight = require('inflight') 9 | 10 | // some request that does some stuff 11 | function req(key, callback) { 12 | // key is any random string. like a url or filename or whatever. 13 | // 14 | // will return either a falsey value, indicating that the 15 | // request for this key is already in flight, or a new callback 16 | // which when called will call all callbacks passed to inflightk 17 | // with the same key 18 | callback = inflight(key, callback) 19 | 20 | // If we got a falsey value back, then there's already a req going 21 | if (!callback) return 22 | 23 | // this is where you'd fetch the url or whatever 24 | // callback is also once()-ified, so it can safely be assigned 25 | // to multiple events etc. First call wins. 26 | setTimeout(function() { 27 | callback(null, key) 28 | }, 100) 29 | } 30 | 31 | // only assigns a single setTimeout 32 | // when it dings, all cbs get called 33 | req('foo', cb1) 34 | req('foo', cb2) 35 | req('foo', cb3) 36 | req('foo', cb4) 37 | ``` 38 | -------------------------------------------------------------------------------- /node_modules/inflight/inflight.js: -------------------------------------------------------------------------------- 1 | var wrappy = require('wrappy') 2 | var reqs = Object.create(null) 3 | var once = require('once') 4 | 5 | module.exports = wrappy(inflight) 6 | 7 | function inflight (key, cb) { 8 | if (reqs[key]) { 9 | reqs[key].push(cb) 10 | return null 11 | } else { 12 | reqs[key] = [cb] 13 | return makeres(key) 14 | } 15 | } 16 | 17 | function makeres (key) { 18 | return once(function RES () { 19 | var cbs = reqs[key] 20 | var len = cbs.length 21 | var args = slice(arguments) 22 | 23 | // XXX It's somewhat ambiguous whether a new callback added in this 24 | // pass should be queued for later execution if something in the 25 | // list of callbacks throws, or if it should just be discarded. 26 | // However, it's such an edge case that it hardly matters, and either 27 | // choice is likely as surprising as the other. 28 | // As it happens, we do go ahead and schedule it for later execution. 29 | try { 30 | for (var i = 0; i < len; i++) { 31 | cbs[i].apply(null, args) 32 | } 33 | } finally { 34 | if (cbs.length > len) { 35 | // added more in the interim. 36 | // de-zalgo, just in case, but don't call again. 37 | cbs.splice(0, len) 38 | process.nextTick(function () { 39 | RES.apply(null, args) 40 | }) 41 | } else { 42 | delete reqs[key] 43 | } 44 | } 45 | }) 46 | } 47 | 48 | function slice (args) { 49 | var length = args.length 50 | var array = [] 51 | 52 | for (var i = 0; i < length; i++) array[i] = args[i] 53 | return array 54 | } 55 | -------------------------------------------------------------------------------- /node_modules/inflight/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "inflight", 6 | "raw": "inflight@^1.0.4", 7 | "rawSpec": "^1.0.4", 8 | "scope": null, 9 | "spec": ">=1.0.4 <2.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob" 13 | ] 14 | ], 15 | "_from": "inflight@>=1.0.4 <2.0.0", 16 | "_id": "inflight@1.0.6", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/inflight", 20 | "_nodeVersion": "6.5.0", 21 | "_npmOperationalInternal": { 22 | "host": "packages-16-east.internal.npmjs.com", 23 | "tmp": "tmp/inflight-1.0.6.tgz_1476330807696_0.10388551792129874" 24 | }, 25 | "_npmUser": { 26 | "email": "i@izs.me", 27 | "name": "isaacs" 28 | }, 29 | "_npmVersion": "3.10.7", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "inflight", 33 | "raw": "inflight@^1.0.4", 34 | "rawSpec": "^1.0.4", 35 | "scope": null, 36 | "spec": ">=1.0.4 <2.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/glob" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 43 | "_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9", 44 | "_shrinkwrap": null, 45 | "_spec": "inflight@^1.0.4", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob", 47 | "author": { 48 | "email": "i@izs.me", 49 | "name": "Isaac Z. Schlueter", 50 | "url": "http://blog.izs.me/" 51 | }, 52 | "bugs": { 53 | "url": "https://github.com/isaacs/inflight/issues" 54 | }, 55 | "dependencies": { 56 | "once": "^1.3.0", 57 | "wrappy": "1" 58 | }, 59 | "description": "Add callbacks to requests in flight to avoid async duplication", 60 | "devDependencies": { 61 | "tap": "^7.1.2" 62 | }, 63 | "directories": {}, 64 | "dist": { 65 | "shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9", 66 | "tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" 67 | }, 68 | "files": [ 69 | "inflight.js" 70 | ], 71 | "gitHead": "a547881738c8f57b27795e584071d67cf6ac1a57", 72 | "homepage": "https://github.com/isaacs/inflight", 73 | "license": "ISC", 74 | "main": "inflight.js", 75 | "maintainers": [ 76 | { 77 | "email": "me@re-becca.org", 78 | "name": "iarna" 79 | }, 80 | { 81 | "email": "i@izs.me", 82 | "name": "isaacs" 83 | }, 84 | { 85 | "email": "ogd@aoaioxxysz.net", 86 | "name": "othiym23" 87 | }, 88 | { 89 | "email": "kat@sykosomatic.org", 90 | "name": "zkat" 91 | } 92 | ], 93 | "name": "inflight", 94 | "optionalDependencies": {}, 95 | "readme": "ERROR: No README data found!", 96 | "repository": { 97 | "type": "git", 98 | "url": "git+https://github.com/npm/inflight.git" 99 | }, 100 | "scripts": { 101 | "test": "tap test.js --100" 102 | }, 103 | "version": "1.0.6" 104 | } 105 | -------------------------------------------------------------------------------- /node_modules/inherits/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 11 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | 17 | -------------------------------------------------------------------------------- /node_modules/inherits/README.md: -------------------------------------------------------------------------------- 1 | Browser-friendly inheritance fully compatible with standard node.js 2 | [inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). 3 | 4 | This package exports standard `inherits` from node.js `util` module in 5 | node environment, but also provides alternative browser-friendly 6 | implementation through [browser 7 | field](https://gist.github.com/shtylman/4339901). Alternative 8 | implementation is a literal copy of standard one located in standalone 9 | module to avoid requiring of `util`. It also has a shim for old 10 | browsers with no `Object.create` support. 11 | 12 | While keeping you sure you are using standard `inherits` 13 | implementation in node.js environment, it allows bundlers such as 14 | [browserify](https://github.com/substack/node-browserify) to not 15 | include full `util` package to your client code if all you need is 16 | just `inherits` function. It worth, because browser shim for `util` 17 | package is large and `inherits` is often the single function you need 18 | from it. 19 | 20 | It's recommended to use this package instead of 21 | `require('util').inherits` for any code that has chances to be used 22 | not only in node.js but in browser too. 23 | 24 | ## usage 25 | 26 | ```js 27 | var inherits = require('inherits'); 28 | // then use exactly as the standard one 29 | ``` 30 | 31 | ## note on version ~1.0 32 | 33 | Version ~1.0 had completely different motivation and is not compatible 34 | neither with 2.0 nor with standard node.js `inherits`. 35 | 36 | If you are using version ~1.0 and planning to switch to ~2.0, be 37 | careful: 38 | 39 | * new version uses `super_` instead of `super` for referencing 40 | superclass 41 | * new version overwrites current prototype while old one preserves any 42 | existing fields on it 43 | -------------------------------------------------------------------------------- /node_modules/inherits/inherits.js: -------------------------------------------------------------------------------- 1 | try { 2 | var util = require('util'); 3 | if (typeof util.inherits !== 'function') throw ''; 4 | module.exports = util.inherits; 5 | } catch (e) { 6 | module.exports = require('./inherits_browser.js'); 7 | } 8 | -------------------------------------------------------------------------------- /node_modules/inherits/inherits_browser.js: -------------------------------------------------------------------------------- 1 | if (typeof Object.create === 'function') { 2 | // implementation from standard node.js 'util' module 3 | module.exports = function inherits(ctor, superCtor) { 4 | ctor.super_ = superCtor 5 | ctor.prototype = Object.create(superCtor.prototype, { 6 | constructor: { 7 | value: ctor, 8 | enumerable: false, 9 | writable: true, 10 | configurable: true 11 | } 12 | }); 13 | }; 14 | } else { 15 | // old school shim for old browsers 16 | module.exports = function inherits(ctor, superCtor) { 17 | ctor.super_ = superCtor 18 | var TempCtor = function () {} 19 | TempCtor.prototype = superCtor.prototype 20 | ctor.prototype = new TempCtor() 21 | ctor.prototype.constructor = ctor 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /node_modules/inherits/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "inherits", 6 | "raw": "inherits@2", 7 | "rawSpec": "2", 8 | "scope": null, 9 | "spec": ">=2.0.0 <3.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob" 13 | ] 14 | ], 15 | "_from": "inherits@>=2.0.0 <3.0.0", 16 | "_id": "inherits@2.0.3", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/inherits", 20 | "_nodeVersion": "6.5.0", 21 | "_npmOperationalInternal": { 22 | "host": "packages-16-east.internal.npmjs.com", 23 | "tmp": "tmp/inherits-2.0.3.tgz_1473295776489_0.08142363070510328" 24 | }, 25 | "_npmUser": { 26 | "email": "i@izs.me", 27 | "name": "isaacs" 28 | }, 29 | "_npmVersion": "3.10.7", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "inherits", 33 | "raw": "inherits@2", 34 | "rawSpec": "2", 35 | "scope": null, 36 | "spec": ">=2.0.0 <3.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/glob" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 43 | "_shasum": "633c2c83e3da42a502f52466022480f4208261de", 44 | "_shrinkwrap": null, 45 | "_spec": "inherits@2", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob", 47 | "browser": "./inherits_browser.js", 48 | "bugs": { 49 | "url": "https://github.com/isaacs/inherits/issues" 50 | }, 51 | "dependencies": {}, 52 | "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", 53 | "devDependencies": { 54 | "tap": "^7.1.0" 55 | }, 56 | "directories": {}, 57 | "dist": { 58 | "shasum": "633c2c83e3da42a502f52466022480f4208261de", 59 | "tarball": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" 60 | }, 61 | "files": [ 62 | "inherits.js", 63 | "inherits_browser.js" 64 | ], 65 | "gitHead": "e05d0fb27c61a3ec687214f0476386b765364d5f", 66 | "homepage": "https://github.com/isaacs/inherits#readme", 67 | "keywords": [ 68 | "inheritance", 69 | "class", 70 | "klass", 71 | "oop", 72 | "object-oriented", 73 | "inherits", 74 | "browser", 75 | "browserify" 76 | ], 77 | "license": "ISC", 78 | "main": "./inherits.js", 79 | "maintainers": [ 80 | { 81 | "email": "i@izs.me", 82 | "name": "isaacs" 83 | } 84 | ], 85 | "name": "inherits", 86 | "optionalDependencies": {}, 87 | "readme": "ERROR: No README data found!", 88 | "repository": { 89 | "type": "git", 90 | "url": "git://github.com/isaacs/inherits.git" 91 | }, 92 | "scripts": { 93 | "test": "node test" 94 | }, 95 | "version": "2.0.3" 96 | } 97 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/.codeclimate.yml: -------------------------------------------------------------------------------- 1 | languages: 2 | JavaScript: true 3 | ratings: 4 | paths: 5 | - "src/**/*.js" 6 | exclude_paths: 7 | - "lib/**" 8 | - "dist/*" 9 | - "grunt/**" 10 | - "images/*" 11 | - "**/*.md" 12 | - "**/*.yml" 13 | - "**/*.json" 14 | - "**/*.scss" 15 | - "**/*.erb" 16 | - "*.sh" 17 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset = utf-8 3 | end_of_line = lf 4 | insert_final_newline = true 5 | 6 | [*.{js, json, sh, yml, gemspec}] 7 | indent_style = space 8 | indent_size = 2 9 | 10 | [{Rakefile, .jshintrc}] 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [*.{py}] 15 | indent_style = space 16 | indent_size = 4 17 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Are you creating an issue in the correct repository? 2 | 3 | - When in doubt, create an issue here. 4 | - If you have an issue with the Jasmine docs, file an issue in the docs repo 5 | here: https://github.com/jasmine/jasmine.github.io 6 | - This repository is for the core Jasmine framework 7 | - If you are using a test runner that wraps Jasmine (Jasmine npm, karma, etc), 8 | consider filing an issue with that library if appropriate 9 | 10 | ### When submitting an issue, please answer the following: 11 | 12 | - What version are you using? 13 | - What environment are you running Jasmine in (node, browser, etc)? 14 | - How are you running Jasmine (standalone, npm, karma, etc)? 15 | - If possible, include an example spec that demonstrates your issue. 16 | 17 | Thanks for using Jasmine! 18 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/.npmignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | grunt/ 3 | node_modules 4 | pkg/ 5 | release_notes/ 6 | spec/ 7 | src/ 8 | Gemfile 9 | Gemfile.lock 10 | Rakefile 11 | jasmine-core.gemspec 12 | .bundle/ 13 | .gitignore 14 | .gitmodules 15 | .idea 16 | .jshintrc 17 | .rspec 18 | .sass-cache/ 19 | .travis.yml 20 | *.sh 21 | *.py 22 | Gruntfile.js 23 | lib/jasmine-core.rb 24 | lib/jasmine-core/boot/ 25 | lib/jasmine-core/spec 26 | lib/jasmine-core/version.rb 27 | lib/jasmine-core/*.py 28 | sauce_connect.log 29 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include . *.py 2 | include lib/jasmine-core/*.js 3 | include lib/jasmine-core/*.css 4 | include images/*.png 5 | include package.json 6 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2017 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/README.md: -------------------------------------------------------------------------------- 1 | [](http://jasmine.github.io) 2 | 3 | [![Build Status](https://travis-ci.org/jasmine/jasmine.svg?branch=master)](https://travis-ci.org/jasmine/jasmine) 4 | [![Code Climate](https://codeclimate.com/github/pivotal/jasmine.svg)](https://codeclimate.com/github/pivotal/jasmine) 5 | 6 | ======= 7 | 8 | **A JavaScript Testing Framework** 9 | 10 | Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, [Node.js](http://nodejs.org) projects, or anywhere that JavaScript can run. 11 | 12 | Documentation & guides live here: [http://jasmine.github.io](http://jasmine.github.io/) 13 | For a quick start guide of Jasmine 2.x, see the beginning of [http://jasmine.github.io/edge/introduction.html](http://jasmine.github.io/edge/introduction.html) 14 | 15 | Upgrading from Jasmine 1.x? Check out the [2.0 release notes](https://github.com/jasmine/jasmine/blob/v2.0.0/release_notes/20.md) for a list of what's new (including breaking interface changes). You can also read the [upgrade guide](http://jasmine.github.io/2.0/upgrading.html). 16 | 17 | ## Contributing 18 | 19 | Please read the [contributors' guide](https://github.com/jasmine/jasmine/blob/master/.github/CONTRIBUTING.md) 20 | 21 | ## Installation 22 | 23 | For the Jasmine NPM module:
24 | [https://github.com/jasmine/jasmine-npm](https://github.com/jasmine/jasmine-npm) 25 | 26 | For the Jasmine Ruby Gem:
27 | [https://github.com/jasmine/jasmine-gem](https://github.com/jasmine/jasmine-gem) 28 | 29 | For the Jasmine Python Egg:
30 | [https://github.com/jasmine/jasmine-py](https://github.com/jasmine/jasmine-py) 31 | 32 | For the Jasmine headless browser gulp plugin:
33 | [https://github.com/jasmine/gulp-jasmine-browser](https://github.com/jasmine/gulp-jasmine-browser) 34 | 35 | To install Jasmine standalone on your local box (where **_{#.#.#}_** below is substituted by the release number downloaded): 36 | 37 | * Download the standalone distribution for your desired release from the [releases page](https://github.com/jasmine/jasmine/releases) 38 | * Create a Jasmine directory in your project - `mkdir my-project/jasmine` 39 | * Move the dist to your project directory - `mv jasmine/dist/jasmine-standalone-{#.#.#}.zip my-project/jasmine` 40 | * Change directory - `cd my-project/jasmine` 41 | * Unzip the dist - `unzip jasmine-standalone-{#.#.#}.zip` 42 | 43 | Add the following to your HTML file: 44 | 45 | ```html 46 | 47 | 48 | 49 | 50 | 51 | 52 | ``` 53 | 54 | ## Supported environments 55 | 56 | Jasmine tests itself across many browsers (Safari, Chrome, Firefox, PhantomJS, and new Internet Explorer) as well as node. To see the exact version tests are run against look at our [.travis.yml](https://github.com/jasmine/jasmine/blob/master/.travis.yml) 57 | 58 | 59 | ## Support 60 | 61 | * Search past discussions: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js) 62 | * Send an email to the list: [jasmine-js@googlegroups.com](mailto:jasmine-js@googlegroups.com) 63 | * View the project backlog at Pivotal Tracker: [http://www.pivotaltracker.com/projects/10606](http://www.pivotaltracker.com/projects/10606) 64 | * Follow us on Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD) 65 | 66 | ## Maintainers 67 | 68 | * [Gregg Van Hove](mailto:gvanhove@pivotal.io), Pivotal Labs 69 | 70 | ### Maintainers Emeritus 71 | 72 | * [Davis W. Frank](mailto:dwfrank@pivotal.io), Pivotal Labs 73 | * [Rajan Agaskar](mailto:rajan@pivotal.io), Pivotal Labs 74 | * [Greg Cobb](mailto:gcobb@pivotal.io), Pivotal Labs 75 | * [Chris Amavisca](mailto:camavisca@pivotal.io), Pivotal Labs 76 | * [Christian Williams](mailto:antixian666@gmail.com), Cloud Foundry 77 | * Sheel Choksi 78 | 79 | Copyright (c) 2008-2017 Pivotal Labs. This software is licensed under the MIT License. 80 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/RELEASE.md: -------------------------------------------------------------------------------- 1 | # How to work on a Jasmine Release 2 | 3 | ## Development 4 | ___Jasmine Core Maintainers Only___ 5 | 6 | Follow the instructions in `CONTRIBUTING.md` during development. 7 | 8 | ### Git Rules 9 | 10 | Please work on feature branches. 11 | 12 | Please attempt to keep commits to `master` small, but cohesive. If a feature is contained in a bunch of small commits (e.g., it has several wip commits or small work), please squash them when merging back to `master`. 13 | 14 | ### Version 15 | 16 | We attempt to stick to [Semantic Versioning](http://semver.org/). Most of the time, development should be against a new minor version - fixing bugs and adding new features that are backwards compatible. 17 | 18 | The current version lives in the file `/package.json`. This version will be the version number that is currently released. When releasing a new version, update `package.json` with the new version and `grunt build:copyVersionToGem` to update the gem version number. 19 | 20 | This version is used by both `jasmine.js` and the `jasmine-core` Ruby gem. 21 | 22 | Note that Jasmine should only use the "patch" version number in the following cases: 23 | 24 | * Changes related to packaging for a specific platform (npm, gem, or pip). 25 | * Fixes for regressions. 26 | 27 | When jasmine-core revs its major or minor version, the binding libraries should also rev to that version. 28 | 29 | ## Release 30 | 31 | When ready to release - specs are all green and the stories are done: 32 | 33 | 1. Update the release notes in `release_notes` - use the Anchorman gem to generate the markdown file and edit accordingly 34 | 1. Update the version in `package.json` to a release candidate 35 | 1. Update any links or top-level landing page for the Github Pages 36 | 37 | ### Build standalone distribution 38 | 39 | 1. Build the standalone distribution with `grunt buildStandaloneDist` 40 | 41 | ### Release the Python egg 42 | 43 | 1. `python setup.py register sdist upload` You will need pypi credentials to upload the egg. 44 | 45 | ### Release the Ruby gem 46 | 47 | 1. Copy version to the Ruby gem with `grunt build:copyVersionToGem` 48 | 1. __NOTE__: You will likely need to point to a local jasmine gem in order to run tests locally. _Do not_ push this version of the Gemfile. 49 | 1. __NOTE__: You will likely need to push a new jasmine gem with a dependent version right after this release. 50 | 1. Push these changes to GitHub and verify that this SHA is green 51 | 1. `rake release` - tags the repo with the version, builds the `jasmine-core` gem, pushes the gem to Rubygems.org. In order to release you will have to ensure you have rubygems creds locally. 52 | 53 | ### Release the NPM 54 | 55 | 1. `npm adduser` to save your credentials locally 56 | 1. `npm publish .` to publish what's in `package.json` 57 | 58 | ### Release the docs 59 | 60 | Probably only need to do this when releasing a minor version, and not a patch version. 61 | 62 | 1. `cp -R edge ${version}` to copy the current edge docs to the new version 63 | 1. Add a link to the new version in `index.html` 64 | 65 | ### Finally 66 | 67 | 1. Visit the [Releases page for Jasmine](https://github.com/jasmine/jasmine/releases), find the tag just pushed. 68 | 1. Paste in a link to the correct release notes for this release. The link should reference the blob and tag correctly, and the markdown file for the notes. 69 | 1. If it is a pre-release, mark it as such. 70 | 1. Attach the standalone zipfile 71 | 72 | 73 | There should be a post to Pivotal Labs blog and a tweet to that link. 74 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jasmine-core", 3 | "homepage": "http://jasmine.github.io", 4 | "authors": [ 5 | "slackersoft " 6 | ], 7 | "description": "Official packaging of Jasmine's core files", 8 | "keywords": [ 9 | "test", 10 | "jasmine", 11 | "tdd", 12 | "bdd" 13 | ], 14 | "license": "MIT", 15 | "moduleType": "globals", 16 | "main": "lib/jasmine-core/jasmine.js", 17 | "ignore": [ 18 | "**/.*", 19 | "dist", 20 | "grunt", 21 | "node_modules", 22 | "pkg", 23 | "release_notes", 24 | "spec", 25 | "src", 26 | "Gemfile", 27 | "Gemfile.lock", 28 | "Rakefile", 29 | "jasmine-core.gemspec", 30 | "*.sh", 31 | "*.py", 32 | "Gruntfile.js", 33 | "lib/jasmine-core.rb", 34 | "lib/jasmine-core/boot/", 35 | "lib/jasmine-core/spec", 36 | "lib/jasmine-core/version.rb", 37 | "lib/jasmine-core/*.py", 38 | "sauce_connect.log" 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/images/jasmine-horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/souiukoto/javascript-test-generator/01b267999b1b9a47675a89de95c3383454d3a561/node_modules/jasmine-core/images/jasmine-horizontal.png -------------------------------------------------------------------------------- /node_modules/jasmine-core/images/jasmine_favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/souiukoto/javascript-test-generator/01b267999b1b9a47675a89de95c3383454d3a561/node_modules/jasmine-core/images/jasmine_favicon.png -------------------------------------------------------------------------------- /node_modules/jasmine-core/jasmine_core.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.1 2 | Name: jasmine-core 3 | Version: 2.6.1 4 | Summary: Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, Node.js (http://nodejs.org) projects, or anywhere that JavaScript can run. 5 | Home-page: http://jasmine.github.io 6 | Author: Pivotal Labs 7 | Author-email: jasmine-js@googlegroups.com 8 | License: MIT 9 | Description: UNKNOWN 10 | Platform: UNKNOWN 11 | Classifier: Development Status :: 5 - Production/Stable 12 | Classifier: Environment :: Console 13 | Classifier: Environment :: Web Environment 14 | Classifier: Framework :: Django 15 | Classifier: Intended Audience :: Developers 16 | Classifier: License :: OSI Approved :: MIT License 17 | Classifier: Operating System :: OS Independent 18 | Classifier: Programming Language :: Python 19 | Classifier: Programming Language :: Python :: 2 20 | Classifier: Programming Language :: Python :: 2.6 21 | Classifier: Programming Language :: Python :: 2.7 22 | Classifier: Programming Language :: Python :: 3 23 | Classifier: Programming Language :: Python :: 3.2 24 | Classifier: Programming Language :: Python :: 3.3 25 | Classifier: Programming Language :: Python :: Implementation :: PyPy 26 | Classifier: Topic :: Internet :: WWW/HTTP 27 | Classifier: Topic :: Software Development :: Libraries :: Python Modules 28 | Classifier: Topic :: Software Development :: Build Tools 29 | Classifier: Topic :: Software Development :: Quality Assurance 30 | Classifier: Topic :: Software Development :: Testing 31 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/jasmine_core.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | MANIFEST.in 2 | package.json 3 | setup.py 4 | ./setup.py 5 | ./images/__init__.py 6 | ./lib/jasmine-core/__init__.py 7 | ./lib/jasmine-core/core.py 8 | ./node_modules/walkdir/test/comparison/find.py 9 | images/__init__.py 10 | images/jasmine-horizontal.png 11 | images/jasmine_favicon.png 12 | jasmine_core.egg-info/PKG-INFO 13 | jasmine_core.egg-info/SOURCES.txt 14 | jasmine_core.egg-info/dependency_links.txt 15 | jasmine_core.egg-info/requires.txt 16 | jasmine_core.egg-info/top_level.txt 17 | lib/jasmine-core/__init__.py 18 | lib/jasmine-core/boot.js 19 | lib/jasmine-core/core.py 20 | lib/jasmine-core/jasmine-html.js 21 | lib/jasmine-core/jasmine.css 22 | lib/jasmine-core/jasmine.js 23 | lib/jasmine-core/json2.js 24 | lib/jasmine-core/node_boot.js -------------------------------------------------------------------------------- /node_modules/jasmine-core/jasmine_core.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/jasmine_core.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | glob2>=0.4.1 2 | ordereddict==1.1 3 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/jasmine_core.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | jasmine_core 2 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./jasmine-core/jasmine.js"); 2 | module.exports.boot = require('./jasmine-core/node_boot.js'); 3 | 4 | var path = require('path'), 5 | fs = require('fs'); 6 | 7 | var rootPath = path.join(__dirname, "jasmine-core"), 8 | bootFiles = ['boot.js'], 9 | nodeBootFiles = ['node_boot.js'], 10 | cssFiles = [], 11 | jsFiles = [], 12 | jsFilesToSkip = ['jasmine.js'].concat(bootFiles, nodeBootFiles); 13 | 14 | fs.readdirSync(rootPath).forEach(function(file) { 15 | if(fs.statSync(path.join(rootPath, file)).isFile()) { 16 | switch(path.extname(file)) { 17 | case '.css': 18 | cssFiles.push(file); 19 | break; 20 | case '.js': 21 | if (jsFilesToSkip.indexOf(file) < 0) { 22 | jsFiles.push(file); 23 | } 24 | break; 25 | } 26 | } 27 | }); 28 | 29 | module.exports.files = { 30 | path: rootPath, 31 | bootDir: rootPath, 32 | bootFiles: bootFiles, 33 | nodeBootFiles: nodeBootFiles, 34 | cssFiles: cssFiles, 35 | jsFiles: ['jasmine.js'].concat(jsFiles), 36 | imagesDir: path.join(__dirname, '../images') 37 | }; 38 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/example/node_example/lib/jasmine_examples/Player.js: -------------------------------------------------------------------------------- 1 | function Player() { 2 | } 3 | Player.prototype.play = function(song) { 4 | this.currentlyPlayingSong = song; 5 | this.isPlaying = true; 6 | }; 7 | 8 | Player.prototype.pause = function() { 9 | this.isPlaying = false; 10 | }; 11 | 12 | Player.prototype.resume = function() { 13 | if (this.isPlaying) { 14 | throw new Error("song is already playing"); 15 | } 16 | 17 | this.isPlaying = true; 18 | }; 19 | 20 | Player.prototype.makeFavorite = function() { 21 | this.currentlyPlayingSong.persistFavoriteStatus(true); 22 | }; 23 | 24 | module.exports = Player; 25 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/example/node_example/lib/jasmine_examples/Song.js: -------------------------------------------------------------------------------- 1 | function Song() { 2 | } 3 | 4 | Song.prototype.persistFavoriteStatus = function(value) { 5 | // something complicated 6 | throw new Error("not yet implemented"); 7 | }; 8 | 9 | module.exports = Song; 10 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/example/node_example/spec/helpers/jasmine_examples/SpecHelper.js: -------------------------------------------------------------------------------- 1 | beforeEach(function () { 2 | jasmine.addMatchers({ 3 | toBePlaying: function () { 4 | return { 5 | compare: function (actual, expected) { 6 | var player = actual; 7 | 8 | return { 9 | pass: player.currentlyPlayingSong === expected && player.isPlaying 10 | } 11 | } 12 | }; 13 | } 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/example/node_example/spec/jasmine_examples/PlayerSpec.js: -------------------------------------------------------------------------------- 1 | describe("Player", function() { 2 | var Player = require('../../lib/jasmine_examples/Player'); 3 | var Song = require('../../lib/jasmine_examples/Song'); 4 | var player; 5 | var song; 6 | 7 | beforeEach(function() { 8 | player = new Player(); 9 | song = new Song(); 10 | }); 11 | 12 | it("should be able to play a Song", function() { 13 | player.play(song); 14 | expect(player.currentlyPlayingSong).toEqual(song); 15 | 16 | //demonstrates use of custom matcher 17 | expect(player).toBePlaying(song); 18 | }); 19 | 20 | describe("when song has been paused", function() { 21 | beforeEach(function() { 22 | player.play(song); 23 | player.pause(); 24 | }); 25 | 26 | it("should indicate that the song is currently paused", function() { 27 | expect(player.isPlaying).toBeFalsy(); 28 | 29 | // demonstrates use of 'not' with a custom matcher 30 | expect(player).not.toBePlaying(song); 31 | }); 32 | 33 | it("should be possible to resume", function() { 34 | player.resume(); 35 | expect(player.isPlaying).toBeTruthy(); 36 | expect(player.currentlyPlayingSong).toEqual(song); 37 | }); 38 | }); 39 | 40 | // demonstrates use of spies to intercept and test method calls 41 | it("tells the current song if the user has made it a favorite", function() { 42 | spyOn(song, 'persistFavoriteStatus'); 43 | 44 | player.play(song); 45 | player.makeFavorite(); 46 | 47 | expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true); 48 | }); 49 | 50 | //demonstrates use of expected exceptions 51 | describe("#resume", function() { 52 | it("should throw an exception if song is already playing", function() { 53 | player.play(song); 54 | 55 | expect(function() { 56 | player.resume(); 57 | }).toThrowError("song is already playing"); 58 | }); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/example/spec/PlayerSpec.js: -------------------------------------------------------------------------------- 1 | describe("Player", function() { 2 | var player; 3 | var song; 4 | 5 | beforeEach(function() { 6 | player = new Player(); 7 | song = new Song(); 8 | }); 9 | 10 | it("should be able to play a Song", function() { 11 | player.play(song); 12 | expect(player.currentlyPlayingSong).toEqual(song); 13 | 14 | //demonstrates use of custom matcher 15 | expect(player).toBePlaying(song); 16 | }); 17 | 18 | describe("when song has been paused", function() { 19 | beforeEach(function() { 20 | player.play(song); 21 | player.pause(); 22 | }); 23 | 24 | it("should indicate that the song is currently paused", function() { 25 | expect(player.isPlaying).toBeFalsy(); 26 | 27 | // demonstrates use of 'not' with a custom matcher 28 | expect(player).not.toBePlaying(song); 29 | }); 30 | 31 | it("should be possible to resume", function() { 32 | player.resume(); 33 | expect(player.isPlaying).toBeTruthy(); 34 | expect(player.currentlyPlayingSong).toEqual(song); 35 | }); 36 | }); 37 | 38 | // demonstrates use of spies to intercept and test method calls 39 | it("tells the current song if the user has made it a favorite", function() { 40 | spyOn(song, 'persistFavoriteStatus'); 41 | 42 | player.play(song); 43 | player.makeFavorite(); 44 | 45 | expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true); 46 | }); 47 | 48 | //demonstrates use of expected exceptions 49 | describe("#resume", function() { 50 | it("should throw an exception if song is already playing", function() { 51 | player.play(song); 52 | 53 | expect(function() { 54 | player.resume(); 55 | }).toThrowError("song is already playing"); 56 | }); 57 | }); 58 | }); 59 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/example/spec/SpecHelper.js: -------------------------------------------------------------------------------- 1 | beforeEach(function () { 2 | jasmine.addMatchers({ 3 | toBePlaying: function () { 4 | return { 5 | compare: function (actual, expected) { 6 | var player = actual; 7 | 8 | return { 9 | pass: player.currentlyPlayingSong === expected && player.isPlaying 10 | }; 11 | } 12 | }; 13 | } 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/example/src/Player.js: -------------------------------------------------------------------------------- 1 | function Player() { 2 | } 3 | Player.prototype.play = function(song) { 4 | this.currentlyPlayingSong = song; 5 | this.isPlaying = true; 6 | }; 7 | 8 | Player.prototype.pause = function() { 9 | this.isPlaying = false; 10 | }; 11 | 12 | Player.prototype.resume = function() { 13 | if (this.isPlaying) { 14 | throw new Error("song is already playing"); 15 | } 16 | 17 | this.isPlaying = true; 18 | }; 19 | 20 | Player.prototype.makeFavorite = function() { 21 | this.currentlyPlayingSong.persistFavoriteStatus(true); 22 | }; -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/example/src/Song.js: -------------------------------------------------------------------------------- 1 | function Song() { 2 | } 3 | 4 | Song.prototype.persistFavoriteStatus = function(value) { 5 | // something complicated 6 | throw new Error("not yet implemented"); 7 | }; -------------------------------------------------------------------------------- /node_modules/jasmine-core/lib/jasmine-core/node_boot.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2017 Pivotal Labs 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | module.exports = function(jasmineRequire) { 24 | var jasmine = jasmineRequire.core(jasmineRequire); 25 | 26 | var consoleFns = require('../console/console.js'); 27 | consoleFns.console(consoleFns, jasmine); 28 | 29 | var env = jasmine.getEnv(); 30 | 31 | var jasmineInterface = jasmineRequire.interface(jasmine, env); 32 | 33 | extend(global, jasmineInterface); 34 | 35 | function extend(destination, source) { 36 | for (var property in source) destination[property] = source[property]; 37 | return destination; 38 | } 39 | 40 | return jasmine; 41 | }; 42 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "jasmine-core", 6 | "raw": "jasmine-core@~2.6.0", 7 | "rawSpec": "~2.6.0", 8 | "scope": null, 9 | "spec": ">=2.6.0 <2.7.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/jasmine" 13 | ] 14 | ], 15 | "_from": "jasmine-core@>=2.6.0 <2.7.0", 16 | "_id": "jasmine-core@2.6.2", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/jasmine-core", 20 | "_nodeVersion": "7.5.0", 21 | "_npmOperationalInternal": { 22 | "host": "packages-18-east.internal.npmjs.com", 23 | "tmp": "tmp/jasmine-core-2.6.2.tgz_1495067429024_0.3984894040040672" 24 | }, 25 | "_npmUser": { 26 | "email": "gregg@slackersoft.net", 27 | "name": "slackersoft" 28 | }, 29 | "_npmVersion": "4.1.2", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "jasmine-core", 33 | "raw": "jasmine-core@~2.6.0", 34 | "rawSpec": "~2.6.0", 35 | "scope": null, 36 | "spec": ">=2.6.0 <2.7.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/jasmine" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.6.2.tgz", 43 | "_shasum": "74ea1f7cf428691af201107d631234027a09daab", 44 | "_shrinkwrap": null, 45 | "_spec": "jasmine-core@~2.6.0", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/jasmine", 47 | "bugs": { 48 | "url": "https://github.com/jasmine/jasmine/issues" 49 | }, 50 | "dependencies": {}, 51 | "description": "Official packaging of Jasmine's core files for use by Node.js projects.", 52 | "devDependencies": { 53 | "glob": "~7.0.5", 54 | "grunt": "^1.0.1", 55 | "grunt-cli": "^1.2.0", 56 | "grunt-contrib-compass": "^1.1.1", 57 | "grunt-contrib-compress": "^1.3.0", 58 | "grunt-contrib-concat": "^1.0.1", 59 | "grunt-contrib-jshint": "^1.0.0", 60 | "jasmine": "^2.5.0", 61 | "load-grunt-tasks": "^0.4.0", 62 | "shelljs": "^0.7.0", 63 | "temp": "~0.8.1" 64 | }, 65 | "directories": {}, 66 | "dist": { 67 | "shasum": "74ea1f7cf428691af201107d631234027a09daab", 68 | "tarball": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.6.2.tgz" 69 | }, 70 | "gitHead": "5d1d19f494b51a073d0c7f59cb2a220c4f042b47", 71 | "homepage": "http://jasmine.github.io", 72 | "keywords": [ 73 | "test", 74 | "jasmine", 75 | "tdd", 76 | "bdd" 77 | ], 78 | "license": "MIT", 79 | "main": "./lib/jasmine-core.js", 80 | "maintainers": [ 81 | { 82 | "email": "dwfrank@pivotallabs.com", 83 | "name": "dwfrank" 84 | }, 85 | { 86 | "email": "gregg@slackersoft.net", 87 | "name": "slackersoft" 88 | } 89 | ], 90 | "name": "jasmine-core", 91 | "optionalDependencies": {}, 92 | "readme": "ERROR: No README data found!", 93 | "repository": { 94 | "type": "git", 95 | "url": "git+https://github.com/jasmine/jasmine.git" 96 | }, 97 | "scripts": { 98 | "test": "grunt jshint execSpecsInNode" 99 | }, 100 | "version": "2.6.2" 101 | } 102 | -------------------------------------------------------------------------------- /node_modules/jasmine-core/requirements.txt: -------------------------------------------------------------------------------- 1 | ordereddict==1.1 2 | -------------------------------------------------------------------------------- /node_modules/jasmine/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - '6' 5 | - '5' 6 | - '4' 7 | - '0.12' 8 | - '0.10' 9 | before_script: 10 | - npm install git+https://github.com/jasmine/jasmine.git 11 | -------------------------------------------------------------------------------- /node_modules/jasmine/Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | var pkg = require("./package.json"); 3 | global.jasmineVersion = pkg.version; 4 | var versionString = 'v' + pkg.version; 5 | 6 | grunt.initConfig({ 7 | pkg: pkg, 8 | jshint: {all: ['lib/**/*.js', 'spec/**/*.js']} 9 | }); 10 | 11 | var shell = require('shelljs'); 12 | function runCommands(commands, done) { 13 | var command = commands.shift(); 14 | 15 | if (command) { 16 | shell.exec(command, function(exitCode) { 17 | if (exitCode !== 0) { 18 | grunt.fail.fatal("Command `" + command + "` failed", exitCode); 19 | done(); 20 | } else { 21 | runCommands(commands, done); 22 | } 23 | }); 24 | } else { 25 | done(); 26 | } 27 | } 28 | 29 | // depend on jshint:all, specs? 30 | grunt.registerTask('release', 31 | 'Create tag ' + versionString + ' and push jasmine-' + pkg.version + ' to NPM', 32 | function() { 33 | var done = this.async(), 34 | commands = ['git tag ' + versionString, 'git push origin master --tags', 'npm publish']; 35 | 36 | runCommands(commands, done); 37 | }); 38 | 39 | grunt.loadNpmTasks('grunt-contrib-jshint'); 40 | 41 | grunt.loadTasks('tasks'); 42 | 43 | grunt.registerTask('default', ['jshint:all', 'specs']); 44 | }; 45 | -------------------------------------------------------------------------------- /node_modules/jasmine/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2016 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /node_modules/jasmine/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/jasmine/jasmine-npm.png?branch=master)](https://travis-ci.org/jasmine/jasmine-npm) 2 | 3 | # The Jasmine Module 4 | 5 | The `jasmine` module is a package of helper code for developing Jasmine projects for Node.js. 6 | 7 | The core of jasmine lives at https://github.com/jasmine/jasmine and is `jasmine-core` in npm. 8 | 9 | ## Contents 10 | 11 | This module allows you to run Jasmine specs for your Node.js code. The output will be displayed in your terminal by default. 12 | 13 | ## Documentation 14 | 15 | http://jasmine.github.io/2.5/node.html 16 | 17 | ## Installation 18 | ```sh 19 | # Local installation: 20 | npm install --save-dev jasmine 21 | 22 | # Global installation 23 | npm install -g jasmine 24 | ``` 25 | 26 | ## Initializing 27 | 28 | To initialize a project for Jasmine 29 | 30 | `jasmine init` 31 | 32 | To seed your project with some examples 33 | 34 | `jasmine examples` 35 | 36 | ## Usage 37 | 38 | To run your test suite 39 | 40 | `jasmine` 41 | 42 | ## Configuration 43 | 44 | Customize `spec/support/jasmine.json` to enumerate the source and spec files you would like the Jasmine runner to include. 45 | You may use dir glob strings. 46 | More information on the format of `jasmine.json` can be found in [the documentation](http://jasmine.github.io/2.4/node.html#section-Configuration) 47 | 48 | Alternatively, you may specify the path to your `jasmine.json` by setting an environment variable or an option: 49 | 50 | `jasmine JASMINE_CONFIG_PATH=relative/path/to/your/jasmine.json` 51 | `jasmine --config=relative/path/to/your/jasmine.json` 52 | 53 | ## Support 54 | 55 | Jasmine Mailing list: [jasmine-js@googlegroups.com](mailto:jasmine-js@googlegroups.com) 56 | Twitter: [@jasminebdd](http://twitter.com/jasminebdd) 57 | 58 | Please file issues here at Github 59 | 60 | Copyright (c) 2008-2016 Pivotal Labs. This software is licensed under the MIT License. 61 | -------------------------------------------------------------------------------- /node_modules/jasmine/bin/jasmine.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var path = require('path'), 4 | Command = require('../lib/command.js'), 5 | Jasmine = require('../lib/jasmine.js'); 6 | 7 | var jasmine = new Jasmine({ projectBaseDir: path.resolve() }); 8 | var examplesDir = path.join(path.dirname(require.resolve('jasmine-core')), 'jasmine-core', 'example', 'node_example'); 9 | var command = new Command(path.resolve(), examplesDir, console.log); 10 | 11 | command.run(jasmine, process.argv.slice(2)); 12 | -------------------------------------------------------------------------------- /node_modules/jasmine/lib/examples/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "spec", 3 | "spec_files": [ 4 | "**/*[sS]pec.js" 5 | ], 6 | "helpers": [ 7 | "helpers/**/*.js" 8 | ], 9 | "stopSpecOnExpectationFailure": false, 10 | "random": false 11 | } 12 | -------------------------------------------------------------------------------- /node_modules/jasmine/lib/exit.js: -------------------------------------------------------------------------------- 1 | module.exports = function(exitCode, platform, nodeVersion, exit, nodeExit) { 2 | if(isWindows(platform) && olderThan12(nodeVersion)) { 3 | nodeExit(exitCode); 4 | } 5 | else { 6 | exit(exitCode); 7 | } 8 | }; 9 | 10 | function isWindows(platform) { 11 | return /^win/.test(platform); 12 | } 13 | 14 | function olderThan12(nodeVersion) { 15 | var version = nodeVersion.split('.'); 16 | return parseInt(version[0].substr(1), 10) <= 0 && parseInt(version[1], 10) < 12; 17 | } -------------------------------------------------------------------------------- /node_modules/jasmine/lib/filters/console_spec_filter.js: -------------------------------------------------------------------------------- 1 | module.exports = exports = ConsoleSpecFilter; 2 | 3 | function ConsoleSpecFilter(options) { 4 | var filterString = options && options.filterString; 5 | var filterPattern = new RegExp(filterString); 6 | 7 | this.matches = function(specName) { 8 | return filterPattern.test(specName); 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /node_modules/jasmine/lib/printDeprecation.js: -------------------------------------------------------------------------------- 1 | module.exports = function(message) { 2 | console.warn('Deprecation warning: ' + message); 3 | }; -------------------------------------------------------------------------------- /node_modules/jasmine/lib/reporters/completion_reporter.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | var results = true; 3 | var onCompleteCallback = function() {}; 4 | var completed = false; 5 | 6 | this.onComplete = function(callback) { 7 | onCompleteCallback = callback; 8 | }; 9 | 10 | this.jasmineDone = function(result) { 11 | completed = true; 12 | if (result && result.failedExpectations && result.failedExpectations.length > 0) { 13 | results = false; 14 | } 15 | onCompleteCallback(results); 16 | }; 17 | 18 | this.isComplete = function() { 19 | return completed; 20 | }; 21 | 22 | this.specDone = function(result) { 23 | if(result.status === 'failed') { 24 | results = false; 25 | } 26 | }; 27 | 28 | this.suiteDone = function(result) { 29 | if (result.failedExpectations && result.failedExpectations.length > 0) { 30 | results = false; 31 | } 32 | }; 33 | }; 34 | -------------------------------------------------------------------------------- /node_modules/jasmine/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "jasmine", 6 | "raw": "jasmine", 7 | "rawSpec": "", 8 | "scope": null, 9 | "spec": "latest", 10 | "type": "tag" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator" 13 | ] 14 | ], 15 | "_from": "jasmine@latest", 16 | "_id": "jasmine@2.6.0", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/jasmine", 20 | "_nodeVersion": "7.5.0", 21 | "_npmOperationalInternal": { 22 | "host": "packages-12-west.internal.npmjs.com", 23 | "tmp": "tmp/jasmine-2.6.0.tgz_1493066784532_0.716917464742437" 24 | }, 25 | "_npmUser": { 26 | "email": "gregg@slackersoft.net", 27 | "name": "slackersoft" 28 | }, 29 | "_npmVersion": "4.1.2", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "jasmine", 33 | "raw": "jasmine", 34 | "rawSpec": "", 35 | "scope": null, 36 | "spec": "latest", 37 | "type": "tag" 38 | }, 39 | "_requiredBy": [ 40 | "/" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.6.0.tgz", 43 | "_shasum": "6b22e70883e8e589d456346153b4d206ddbe217f", 44 | "_shrinkwrap": null, 45 | "_spec": "jasmine", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator", 47 | "bin": { 48 | "jasmine": "./bin/jasmine.js" 49 | }, 50 | "bugs": { 51 | "url": "https://github.com/jasmine/jasmine-npm/issues" 52 | }, 53 | "dependencies": { 54 | "exit": "^0.1.2", 55 | "glob": "^7.0.6", 56 | "jasmine-core": "~2.6.0" 57 | }, 58 | "description": "Command line jasmine", 59 | "devDependencies": { 60 | "grunt": "^0.4.2", 61 | "grunt-cli": "^0.1.13", 62 | "grunt-contrib-jshint": "^0.11.0", 63 | "shelljs": "^0.3.0" 64 | }, 65 | "directories": {}, 66 | "dist": { 67 | "shasum": "6b22e70883e8e589d456346153b4d206ddbe217f", 68 | "tarball": "https://registry.npmjs.org/jasmine/-/jasmine-2.6.0.tgz" 69 | }, 70 | "gitHead": "94de6d5a6789ffe719603e9649bf667658df7b5b", 71 | "homepage": "http://jasmine.github.io/", 72 | "keywords": [ 73 | "test", 74 | "jasmine", 75 | "tdd", 76 | "bdd" 77 | ], 78 | "license": "MIT", 79 | "main": "./lib/jasmine.js", 80 | "maintainers": [ 81 | { 82 | "email": "gregg@slackersoft.net", 83 | "name": "slackersoft" 84 | }, 85 | { 86 | "email": "dwfrank@pivotallabs.com", 87 | "name": "dwfrank" 88 | }, 89 | { 90 | "email": "chris.amavisca@gmail.com", 91 | "name": "amavisca" 92 | } 93 | ], 94 | "name": "jasmine", 95 | "optionalDependencies": {}, 96 | "readme": "ERROR: No README data found!", 97 | "repository": { 98 | "type": "git", 99 | "url": "git+https://github.com/jasmine/jasmine-npm.git" 100 | }, 101 | "scripts": { 102 | "test": "grunt && ./bin/jasmine.js" 103 | }, 104 | "version": "2.6.0" 105 | } 106 | -------------------------------------------------------------------------------- /node_modules/jasmine/tasks/jasmine.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(grunt) { 4 | var Jasmine = require('../lib/jasmine'); 5 | 6 | grunt.registerTask('specs', function() { 7 | var jasmine = new Jasmine(); 8 | var done = this.async(); 9 | 10 | jasmine.loadConfigFile(process.env.JASMINE_CONFIG_PATH || './spec/support/jasmine.json'); 11 | jasmine.onComplete(done); 12 | jasmine.execute(); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /node_modules/minimatch/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter and Contributors 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /node_modules/minimatch/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "minimatch", 6 | "raw": "minimatch@^3.0.4", 7 | "rawSpec": "^3.0.4", 8 | "scope": null, 9 | "spec": ">=3.0.4 <4.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob" 13 | ] 14 | ], 15 | "_from": "minimatch@>=3.0.4 <4.0.0", 16 | "_id": "minimatch@3.0.4", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/minimatch", 20 | "_nodeVersion": "8.0.0-pre", 21 | "_npmOperationalInternal": { 22 | "host": "packages-18-east.internal.npmjs.com", 23 | "tmp": "tmp/minimatch-3.0.4.tgz_1494180669024_0.22628829116001725" 24 | }, 25 | "_npmUser": { 26 | "email": "i@izs.me", 27 | "name": "isaacs" 28 | }, 29 | "_npmVersion": "5.0.0-beta.43", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "minimatch", 33 | "raw": "minimatch@^3.0.4", 34 | "rawSpec": "^3.0.4", 35 | "scope": null, 36 | "spec": ">=3.0.4 <4.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/glob" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 43 | "_shasum": "5166e286457f03306064be5497e8dbb0c3d32083", 44 | "_shrinkwrap": null, 45 | "_spec": "minimatch@^3.0.4", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob", 47 | "author": { 48 | "email": "i@izs.me", 49 | "name": "Isaac Z. Schlueter", 50 | "url": "http://blog.izs.me" 51 | }, 52 | "bugs": { 53 | "url": "https://github.com/isaacs/minimatch/issues" 54 | }, 55 | "dependencies": { 56 | "brace-expansion": "^1.1.7" 57 | }, 58 | "description": "a glob matcher in javascript", 59 | "devDependencies": { 60 | "tap": "^10.3.2" 61 | }, 62 | "directories": {}, 63 | "dist": { 64 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 65 | "shasum": "5166e286457f03306064be5497e8dbb0c3d32083", 66 | "tarball": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz" 67 | }, 68 | "engines": { 69 | "node": "*" 70 | }, 71 | "files": [ 72 | "minimatch.js" 73 | ], 74 | "gitHead": "e46989a323d5f0aa4781eff5e2e6e7aafa223321", 75 | "homepage": "https://github.com/isaacs/minimatch#readme", 76 | "license": "ISC", 77 | "main": "minimatch.js", 78 | "maintainers": [ 79 | { 80 | "email": "i@izs.me", 81 | "name": "isaacs" 82 | } 83 | ], 84 | "name": "minimatch", 85 | "optionalDependencies": {}, 86 | "readme": "ERROR: No README data found!", 87 | "repository": { 88 | "type": "git", 89 | "url": "git://github.com/isaacs/minimatch.git" 90 | }, 91 | "scripts": { 92 | "postpublish": "git push origin --all; git push origin --tags", 93 | "postversion": "npm publish", 94 | "preversion": "npm test", 95 | "test": "tap test/*.js --cov" 96 | }, 97 | "version": "3.0.4" 98 | } 99 | -------------------------------------------------------------------------------- /node_modules/once/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter and Contributors 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /node_modules/once/README.md: -------------------------------------------------------------------------------- 1 | # once 2 | 3 | Only call a function once. 4 | 5 | ## usage 6 | 7 | ```javascript 8 | var once = require('once') 9 | 10 | function load (file, cb) { 11 | cb = once(cb) 12 | loader.load('file') 13 | loader.once('load', cb) 14 | loader.once('error', cb) 15 | } 16 | ``` 17 | 18 | Or add to the Function.prototype in a responsible way: 19 | 20 | ```javascript 21 | // only has to be done once 22 | require('once').proto() 23 | 24 | function load (file, cb) { 25 | cb = cb.once() 26 | loader.load('file') 27 | loader.once('load', cb) 28 | loader.once('error', cb) 29 | } 30 | ``` 31 | 32 | Ironically, the prototype feature makes this module twice as 33 | complicated as necessary. 34 | 35 | To check whether you function has been called, use `fn.called`. Once the 36 | function is called for the first time the return value of the original 37 | function is saved in `fn.value` and subsequent calls will continue to 38 | return this value. 39 | 40 | ```javascript 41 | var once = require('once') 42 | 43 | function load (cb) { 44 | cb = once(cb) 45 | var stream = createStream() 46 | stream.once('data', cb) 47 | stream.once('end', function () { 48 | if (!cb.called) cb(new Error('not found')) 49 | }) 50 | } 51 | ``` 52 | 53 | ## `once.strict(func)` 54 | 55 | Throw an error if the function is called twice. 56 | 57 | Some functions are expected to be called only once. Using `once` for them would 58 | potentially hide logical errors. 59 | 60 | In the example below, the `greet` function has to call the callback only once: 61 | 62 | ```javascript 63 | function greet (name, cb) { 64 | // return is missing from the if statement 65 | // when no name is passed, the callback is called twice 66 | if (!name) cb('Hello anonymous') 67 | cb('Hello ' + name) 68 | } 69 | 70 | function log (msg) { 71 | console.log(msg) 72 | } 73 | 74 | // this will print 'Hello anonymous' but the logical error will be missed 75 | greet(null, once(msg)) 76 | 77 | // once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time 78 | greet(null, once.strict(msg)) 79 | ``` 80 | -------------------------------------------------------------------------------- /node_modules/once/once.js: -------------------------------------------------------------------------------- 1 | var wrappy = require('wrappy') 2 | module.exports = wrappy(once) 3 | module.exports.strict = wrappy(onceStrict) 4 | 5 | once.proto = once(function () { 6 | Object.defineProperty(Function.prototype, 'once', { 7 | value: function () { 8 | return once(this) 9 | }, 10 | configurable: true 11 | }) 12 | 13 | Object.defineProperty(Function.prototype, 'onceStrict', { 14 | value: function () { 15 | return onceStrict(this) 16 | }, 17 | configurable: true 18 | }) 19 | }) 20 | 21 | function once (fn) { 22 | var f = function () { 23 | if (f.called) return f.value 24 | f.called = true 25 | return f.value = fn.apply(this, arguments) 26 | } 27 | f.called = false 28 | return f 29 | } 30 | 31 | function onceStrict (fn) { 32 | var f = function () { 33 | if (f.called) 34 | throw new Error(f.onceError) 35 | f.called = true 36 | return f.value = fn.apply(this, arguments) 37 | } 38 | var name = fn.name || 'Function wrapped with `once`' 39 | f.onceError = name + " shouldn't be called more than once" 40 | f.called = false 41 | return f 42 | } 43 | -------------------------------------------------------------------------------- /node_modules/once/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "once", 6 | "raw": "once@^1.3.0", 7 | "rawSpec": "^1.3.0", 8 | "scope": null, 9 | "spec": ">=1.3.0 <2.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob" 13 | ] 14 | ], 15 | "_from": "once@>=1.3.0 <2.0.0", 16 | "_id": "once@1.4.0", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/once", 20 | "_nodeVersion": "6.5.0", 21 | "_npmOperationalInternal": { 22 | "host": "packages-12-west.internal.npmjs.com", 23 | "tmp": "tmp/once-1.4.0.tgz_1473196269128_0.537820661207661" 24 | }, 25 | "_npmUser": { 26 | "email": "i@izs.me", 27 | "name": "isaacs" 28 | }, 29 | "_npmVersion": "3.10.7", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "once", 33 | "raw": "once@^1.3.0", 34 | "rawSpec": "^1.3.0", 35 | "scope": null, 36 | "spec": ">=1.3.0 <2.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/glob", 41 | "/inflight" 42 | ], 43 | "_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 44 | "_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1", 45 | "_shrinkwrap": null, 46 | "_spec": "once@^1.3.0", 47 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob", 48 | "author": { 49 | "email": "i@izs.me", 50 | "name": "Isaac Z. Schlueter", 51 | "url": "http://blog.izs.me/" 52 | }, 53 | "bugs": { 54 | "url": "https://github.com/isaacs/once/issues" 55 | }, 56 | "dependencies": { 57 | "wrappy": "1" 58 | }, 59 | "description": "Run a function exactly one time", 60 | "devDependencies": { 61 | "tap": "^7.0.1" 62 | }, 63 | "directories": { 64 | "test": "test" 65 | }, 66 | "dist": { 67 | "shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1", 68 | "tarball": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" 69 | }, 70 | "files": [ 71 | "once.js" 72 | ], 73 | "gitHead": "0e614d9f5a7e6f0305c625f6b581f6d80b33b8a6", 74 | "homepage": "https://github.com/isaacs/once#readme", 75 | "keywords": [ 76 | "once", 77 | "function", 78 | "one", 79 | "single" 80 | ], 81 | "license": "ISC", 82 | "main": "once.js", 83 | "maintainers": [ 84 | { 85 | "email": "i@izs.me", 86 | "name": "isaacs" 87 | } 88 | ], 89 | "name": "once", 90 | "optionalDependencies": {}, 91 | "readme": "ERROR: No README data found!", 92 | "repository": { 93 | "type": "git", 94 | "url": "git://github.com/isaacs/once.git" 95 | }, 96 | "scripts": { 97 | "test": "tap test/*.js" 98 | }, 99 | "version": "1.4.0" 100 | } 101 | -------------------------------------------------------------------------------- /node_modules/path-is-absolute/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function posix(path) { 4 | return path.charAt(0) === '/'; 5 | } 6 | 7 | function win32(path) { 8 | // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 9 | var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; 10 | var result = splitDeviceRe.exec(path); 11 | var device = result[1] || ''; 12 | var isUnc = Boolean(device && device.charAt(1) !== ':'); 13 | 14 | // UNC paths are always absolute 15 | return Boolean(result[2] || isUnc); 16 | } 17 | 18 | module.exports = process.platform === 'win32' ? win32 : posix; 19 | module.exports.posix = posix; 20 | module.exports.win32 = win32; 21 | -------------------------------------------------------------------------------- /node_modules/path-is-absolute/license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/path-is-absolute/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "path-is-absolute", 6 | "raw": "path-is-absolute@^1.0.0", 7 | "rawSpec": "^1.0.0", 8 | "scope": null, 9 | "spec": ">=1.0.0 <2.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob" 13 | ] 14 | ], 15 | "_from": "path-is-absolute@>=1.0.0 <2.0.0", 16 | "_id": "path-is-absolute@1.0.1", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/path-is-absolute", 20 | "_nodeVersion": "6.6.0", 21 | "_npmOperationalInternal": { 22 | "host": "packages-12-west.internal.npmjs.com", 23 | "tmp": "tmp/path-is-absolute-1.0.1.tgz_1475210523565_0.9876507974695414" 24 | }, 25 | "_npmUser": { 26 | "email": "sindresorhus@gmail.com", 27 | "name": "sindresorhus" 28 | }, 29 | "_npmVersion": "3.10.3", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "path-is-absolute", 33 | "raw": "path-is-absolute@^1.0.0", 34 | "rawSpec": "^1.0.0", 35 | "scope": null, 36 | "spec": ">=1.0.0 <2.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/glob" 41 | ], 42 | "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 43 | "_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", 44 | "_shrinkwrap": null, 45 | "_spec": "path-is-absolute@^1.0.0", 46 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/glob", 47 | "author": { 48 | "email": "sindresorhus@gmail.com", 49 | "name": "Sindre Sorhus", 50 | "url": "sindresorhus.com" 51 | }, 52 | "bugs": { 53 | "url": "https://github.com/sindresorhus/path-is-absolute/issues" 54 | }, 55 | "dependencies": {}, 56 | "description": "Node.js 0.12 path.isAbsolute() ponyfill", 57 | "devDependencies": { 58 | "xo": "^0.16.0" 59 | }, 60 | "directories": {}, 61 | "dist": { 62 | "shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", 63 | "tarball": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" 64 | }, 65 | "engines": { 66 | "node": ">=0.10.0" 67 | }, 68 | "files": [ 69 | "index.js" 70 | ], 71 | "gitHead": "edc91d348b21dac2ab65ea2fbec2868e2eff5eb6", 72 | "homepage": "https://github.com/sindresorhus/path-is-absolute#readme", 73 | "keywords": [ 74 | "path", 75 | "paths", 76 | "file", 77 | "dir", 78 | "absolute", 79 | "isabsolute", 80 | "is-absolute", 81 | "built-in", 82 | "util", 83 | "utils", 84 | "core", 85 | "ponyfill", 86 | "polyfill", 87 | "shim", 88 | "is", 89 | "detect", 90 | "check" 91 | ], 92 | "license": "MIT", 93 | "maintainers": [ 94 | { 95 | "email": "sindresorhus@gmail.com", 96 | "name": "sindresorhus" 97 | } 98 | ], 99 | "name": "path-is-absolute", 100 | "optionalDependencies": {}, 101 | "readme": "ERROR: No README data found!", 102 | "repository": { 103 | "type": "git", 104 | "url": "git+https://github.com/sindresorhus/path-is-absolute.git" 105 | }, 106 | "scripts": { 107 | "test": "xo && node test.js" 108 | }, 109 | "version": "1.0.1" 110 | } 111 | -------------------------------------------------------------------------------- /node_modules/path-is-absolute/readme.md: -------------------------------------------------------------------------------- 1 | # path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) 2 | 3 | > Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) 4 | 5 | 6 | ## Install 7 | 8 | ``` 9 | $ npm install --save path-is-absolute 10 | ``` 11 | 12 | 13 | ## Usage 14 | 15 | ```js 16 | const pathIsAbsolute = require('path-is-absolute'); 17 | 18 | // Running on Linux 19 | pathIsAbsolute('/home/foo'); 20 | //=> true 21 | pathIsAbsolute('C:/Users/foo'); 22 | //=> false 23 | 24 | // Running on Windows 25 | pathIsAbsolute('C:/Users/foo'); 26 | //=> true 27 | pathIsAbsolute('/home/foo'); 28 | //=> false 29 | 30 | // Running on any OS 31 | pathIsAbsolute.posix('/home/foo'); 32 | //=> true 33 | pathIsAbsolute.posix('C:/Users/foo'); 34 | //=> false 35 | pathIsAbsolute.win32('C:/Users/foo'); 36 | //=> true 37 | pathIsAbsolute.win32('/home/foo'); 38 | //=> false 39 | ``` 40 | 41 | 42 | ## API 43 | 44 | See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). 45 | 46 | ### pathIsAbsolute(path) 47 | 48 | ### pathIsAbsolute.posix(path) 49 | 50 | POSIX specific version. 51 | 52 | ### pathIsAbsolute.win32(path) 53 | 54 | Windows specific version. 55 | 56 | 57 | ## License 58 | 59 | MIT © [Sindre Sorhus](https://sindresorhus.com) 60 | -------------------------------------------------------------------------------- /node_modules/wrappy/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter and Contributors 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /node_modules/wrappy/README.md: -------------------------------------------------------------------------------- 1 | # wrappy 2 | 3 | Callback wrapping utility 4 | 5 | ## USAGE 6 | 7 | ```javascript 8 | var wrappy = require("wrappy") 9 | 10 | // var wrapper = wrappy(wrapperFunction) 11 | 12 | // make sure a cb is called only once 13 | // See also: http://npm.im/once for this specific use case 14 | var once = wrappy(function (cb) { 15 | var called = false 16 | return function () { 17 | if (called) return 18 | called = true 19 | return cb.apply(this, arguments) 20 | } 21 | }) 22 | 23 | function printBoo () { 24 | console.log('boo') 25 | } 26 | // has some rando property 27 | printBoo.iAmBooPrinter = true 28 | 29 | var onlyPrintOnce = once(printBoo) 30 | 31 | onlyPrintOnce() // prints 'boo' 32 | onlyPrintOnce() // does nothing 33 | 34 | // random property is retained! 35 | assert.equal(onlyPrintOnce.iAmBooPrinter, true) 36 | ``` 37 | -------------------------------------------------------------------------------- /node_modules/wrappy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_args": [ 3 | [ 4 | { 5 | "name": "wrappy", 6 | "raw": "wrappy@1", 7 | "rawSpec": "1", 8 | "scope": null, 9 | "spec": ">=1.0.0 <2.0.0", 10 | "type": "range" 11 | }, 12 | "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/inflight" 13 | ] 14 | ], 15 | "_from": "wrappy@>=1.0.0 <2.0.0", 16 | "_id": "wrappy@1.0.2", 17 | "_inCache": true, 18 | "_installable": true, 19 | "_location": "/wrappy", 20 | "_nodeVersion": "5.10.1", 21 | "_npmOperationalInternal": { 22 | "host": "packages-16-east.internal.npmjs.com", 23 | "tmp": "tmp/wrappy-1.0.2.tgz_1463527848281_0.037129373755306005" 24 | }, 25 | "_npmUser": { 26 | "email": "kat@sykosomatic.org", 27 | "name": "zkat" 28 | }, 29 | "_npmVersion": "3.9.1", 30 | "_phantomChildren": {}, 31 | "_requested": { 32 | "name": "wrappy", 33 | "raw": "wrappy@1", 34 | "rawSpec": "1", 35 | "scope": null, 36 | "spec": ">=1.0.0 <2.0.0", 37 | "type": "range" 38 | }, 39 | "_requiredBy": [ 40 | "/inflight", 41 | "/once" 42 | ], 43 | "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 44 | "_shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f", 45 | "_shrinkwrap": null, 46 | "_spec": "wrappy@1", 47 | "_where": "/Users/petermckinley/Desktop/aa-practice-test-generator/node_modules/inflight", 48 | "author": { 49 | "email": "i@izs.me", 50 | "name": "Isaac Z. Schlueter", 51 | "url": "http://blog.izs.me/" 52 | }, 53 | "bugs": { 54 | "url": "https://github.com/npm/wrappy/issues" 55 | }, 56 | "dependencies": {}, 57 | "description": "Callback wrapping utility", 58 | "devDependencies": { 59 | "tap": "^2.3.1" 60 | }, 61 | "directories": { 62 | "test": "test" 63 | }, 64 | "dist": { 65 | "shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f", 66 | "tarball": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" 67 | }, 68 | "files": [ 69 | "wrappy.js" 70 | ], 71 | "gitHead": "71d91b6dc5bdeac37e218c2cf03f9ab55b60d214", 72 | "homepage": "https://github.com/npm/wrappy", 73 | "license": "ISC", 74 | "main": "wrappy.js", 75 | "maintainers": [ 76 | { 77 | "email": "i@izs.me", 78 | "name": "isaacs" 79 | }, 80 | { 81 | "email": "kat@sykosomatic.org", 82 | "name": "zkat" 83 | } 84 | ], 85 | "name": "wrappy", 86 | "optionalDependencies": {}, 87 | "readme": "ERROR: No README data found!", 88 | "repository": { 89 | "type": "git", 90 | "url": "git+https://github.com/npm/wrappy.git" 91 | }, 92 | "scripts": { 93 | "test": "tap --coverage test/*.js" 94 | }, 95 | "version": "1.0.2" 96 | } 97 | -------------------------------------------------------------------------------- /node_modules/wrappy/wrappy.js: -------------------------------------------------------------------------------- 1 | // Returns a wrapper function that returns a wrapped callback 2 | // The wrapper function should do some stuff, and return a 3 | // presumably different callback function. 4 | // This makes sure that own properties are retained, so that 5 | // decorations and such are not lost along the way. 6 | module.exports = wrappy 7 | function wrappy (fn, cb) { 8 | if (fn && cb) return wrappy(fn)(cb) 9 | 10 | if (typeof fn !== 'function') 11 | throw new TypeError('need wrapper function') 12 | 13 | Object.keys(fn).forEach(function (k) { 14 | wrapper[k] = fn[k] 15 | }) 16 | 17 | return wrapper 18 | 19 | function wrapper() { 20 | var args = new Array(arguments.length) 21 | for (var i = 0; i < args.length; i++) { 22 | args[i] = arguments[i] 23 | } 24 | var ret = fn.apply(this, args) 25 | var cb = args[args.length-1] 26 | if (typeof ret === 'function' && ret !== cb) { 27 | Object.keys(cb).forEach(function (k) { 28 | ret[k] = cb[k] 29 | }) 30 | } 31 | return ret 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /problems/base_converter.js: -------------------------------------------------------------------------------- 1 | // Write a recursive method that takes in a base 10 number n and 2 | // converts it to a base b number. Return the new number as a string 3 | // 4 | // E.g. base_converter(5, 2) == "101" 5 | // base_converter(31, 16) == "1f" 6 | 7 | function baseConverter(num, b) { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /problems/binary_search.js: -------------------------------------------------------------------------------- 1 | // # Write a monkey patch of binary search: 2 | // # E.g. [1, 2, 3, 4, 5, 7].my_bsearch(5) => 4 3 | 4 | Array.prototype.myBsearch = function (target, func) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/bubble_sort.js: -------------------------------------------------------------------------------- 1 | Array.prototype.bubbleSort = function (func) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/caesar_cipher.js: -------------------------------------------------------------------------------- 1 | // Back in the good old days, you used to be able to write a darn near 2 | // uncrackable code by simply taking each letter of a message and incrementing it 3 | // by a fixed number, so "abc" by 2 would look like "cde", wrapping around back 4 | // to "a" when you pass "z". Write a function, `caesar_cipher(str, shift)` which 5 | // will take a message and an increment amount and outputs the encoded message. 6 | // Assume lowercase and no punctuation. Preserve spaces. 7 | // 8 | // To get an array of letters "a" to "z", you may use `("a".."z").to_a`. To find 9 | // the position of a letter in the array, you may use `Array#find_index`. 10 | 11 | function caesarCipher(str, shift) { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /problems/deep_dup.js: -------------------------------------------------------------------------------- 1 | // Using recursion and the is_a? method, 2 | // write an Array#deep_dup method that will perform a "deep" duplication of the interior arrays. 3 | 4 | function deepDup(arr) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/digital_root.js: -------------------------------------------------------------------------------- 1 | // Write a method, `digital_root(num)`. It should Sum the digits of a positive 2 | // integer. If it is greater than 10, sum the digits of the resulting number. 3 | // Keep repeating until there is only one digit in the result, called the 4 | // "digital root". **Do not use string conversion within your method.** 5 | // 6 | // You may wish to use a helper function, `digital_root_step(num)` which performs 7 | // one step of the process. 8 | 9 | function digitalRoot(num) { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /problems/doubler.js: -------------------------------------------------------------------------------- 1 | // Write a method that doubles each element in an array 2 | 3 | function doubler(array) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /problems/dups.js: -------------------------------------------------------------------------------- 1 | // Write an Array#dups method that will return a hash containing the indices of all 2 | // duplicate elements. The keys are the duplicate elements; the values are 3 | // arrays of their indices in ascending order, e.g. 4 | // [1, 3, 4, 3, 0, 3, 0].dups => { 3 => [1, 3, 5], 0 => [4, 6] } 5 | 6 | Array.prototype.dups = function() { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /problems/exponent.js: -------------------------------------------------------------------------------- 1 | // return b^n recursively. Your solution should accept negative values 2 | // for n 3 | 4 | function exponent(b, n) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/factorials_rec.js: -------------------------------------------------------------------------------- 1 | // Write a recursive method that returns the first "num" factorial numbers. 2 | // Note that the 1st factorial number is 0!, which equals 1. The 2nd factorial 3 | // is 1!, the 3rd factorial is 2!, etc. 4 | 5 | function factorialsRec(num) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /problems/factors.js: -------------------------------------------------------------------------------- 1 | // Write a method that returns the factors of a number in ascending order. 2 | 3 | function factors(num) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /problems/fibs_sum.js: -------------------------------------------------------------------------------- 1 | // Implement a method that finds the sum of the first n 2 | // fibonacci numbers recursively. Assume n > 0 3 | 4 | function fibsSum(n) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/first_even_numbers_sum.js: -------------------------------------------------------------------------------- 1 | // return the sum of the first n even numbers recursively. Assume n > 0 2 | 3 | function firstEvenNumbersSum(n) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /problems/inherits.js: -------------------------------------------------------------------------------- 1 | // write Function.prototype.inherits. 2 | 3 | Function.prototype.inherits = function () { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /problems/jumble_sort.js: -------------------------------------------------------------------------------- 1 | // Jumble sort takes a string and an alphabet. It returns a copy of the string 2 | // with the letters re-ordered according to their positions in the alphabet. If 3 | // no alphabet is passed in, it defaults to normal alphabetical order (a-z). 4 | // 5 | // Example: 6 | // jumble_sort("hello") => "ehllo" 7 | // jumble_sort("hello", ['o', 'l', 'h', 'e']) => 'ollhe' 8 | 9 | function jumbleSort(str, alphabet = null) { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /problems/median.js: -------------------------------------------------------------------------------- 1 | // Write a method that returns the median of elements in an array 2 | // If the length is even, return the average of the middle two elements 3 | 4 | Array.prototype.median = function () { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/merge_sort.js: -------------------------------------------------------------------------------- 1 | // Write an Array#merge_sort method; it should not modify the original array. 2 | 3 | Array.prototype.mergeSort = function (func) { 4 | 5 | } 6 | 7 | Array.prototype.merge = function (arr, func) { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /problems/my_bind.js: -------------------------------------------------------------------------------- 1 | // write Function.prototype.myBind. 2 | Function.prototype.myBind = function () { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /problems/my_call.js: -------------------------------------------------------------------------------- 1 | Function.prototype.myCall = function (ctx, ...args) { 2 | 3 | }; 4 | -------------------------------------------------------------------------------- /problems/my_curry.js: -------------------------------------------------------------------------------- 1 | Function.prototype.myCurry = function (numArgs) { 2 | 3 | }; 4 | -------------------------------------------------------------------------------- /problems/my_each.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myEach = function (func) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/my_every.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myEvery = function (func) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/my_filter.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myFilter = function (func) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/my_find.js: -------------------------------------------------------------------------------- 1 | // write myFind(array, callback). It should return the first element for which 2 | // callback returns true, or undefined if none is found. 3 | 4 | Array.prototype.myFind = function (array, callback) { 5 | 6 | }; 7 | -------------------------------------------------------------------------------- /problems/my_flatten.js: -------------------------------------------------------------------------------- 1 | Array.prototype.flatten = function () { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/my_inject.js: -------------------------------------------------------------------------------- 1 | // Monkey patch the Array class and add a my_inject method. If my_inject receives 2 | // no argument, then use the first element of the array as the default accumulator. 3 | 4 | Array.prototype.myReduce = function (func, acc) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/my_join.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myJoin = function (separator) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/my_reject.js: -------------------------------------------------------------------------------- 1 | Array.prototype.reject = function (func) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/my_reverse.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myReverse = function () { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/my_rotate.js: -------------------------------------------------------------------------------- 1 | Array.prototype.rotate = function (num) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/my_slice.js: -------------------------------------------------------------------------------- 1 | // write String.prototype.mySlice. It should take a start index and an 2 | // (optional) end index. 3 | 4 | String.prototype.mySlice = function () { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/my_some.js: -------------------------------------------------------------------------------- 1 | Array.prototype.mySome = function (func) { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /problems/permutations.js: -------------------------------------------------------------------------------- 1 | // Write a recursive method that returns all of the permutations of an array 2 | 3 | function permutations(array) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /problems/pig_latinify.js: -------------------------------------------------------------------------------- 1 | // Write a method that translates a sentence into pig latin. You may want a helper method. 2 | // 'apple' => 'appleay' 3 | // 'pearl' => 'earlpay' 4 | // 'quick' => 'ickquay' 5 | 6 | function piglatinify(sentence) { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /problems/prime_factorization.js: -------------------------------------------------------------------------------- 1 | // Write a recursive function that returns the prime factorization of 2 | // a given number. Assume num > 1 3 | // 4 | // prime_factorization(12) => [2,2,3] 5 | 6 | function primeFactorization(num) { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /problems/primes.js: -------------------------------------------------------------------------------- 1 | // primes(num) returns an array of the first "num" primes. 2 | // You may wish to use an is_prime helper method. 3 | 4 | function primes(num) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/quicksort.js: -------------------------------------------------------------------------------- 1 | // Write a monkey patch of quick sort that accepts a callback 2 | 3 | Array.prototype.quickSort = function (func) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /problems/real_words_in_string.js: -------------------------------------------------------------------------------- 1 | // Returns an array of all the subwords of the string that appear in the 2 | // dictionary argument. The method does NOT return any duplicates. 3 | 4 | String.prototype.realWordsInString = function (dictionary) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/rec_sum.js: -------------------------------------------------------------------------------- 1 | // Write a recursive method that returns the sum of all elements in an array 2 | 3 | function recSum(nums) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /problems/string_include_key.js: -------------------------------------------------------------------------------- 1 | // Write a recursive method that takes in a string to search and a key string. 2 | // Return true if the string contains all of the characters in the key 3 | // in the same order that they appear in the key. 4 | // 5 | // string_include_key?("cadbpc", "abc") => true 6 | // string_include_key("cba", "abc") => false 7 | 8 | function stringIncludeKey(string, key) { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /problems/subsets.js: -------------------------------------------------------------------------------- 1 | // returns all subsets of an array 2 | 3 | function subsets(array) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /problems/symmetric_substrings.js: -------------------------------------------------------------------------------- 1 | // Write a String#symmetric_substrings method that returns an array of substrings 2 | // that are palindromes, e.g. "cool".symmetric_substrings => ["oo"] 3 | // Only include substrings of length > 1. 4 | 5 | String.prototype.symmetricSubstrings = function () { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /problems/titleize.js: -------------------------------------------------------------------------------- 1 | // Write a method that capitalizes each word in a string like a book title 2 | // Do not capitalize words like 'a', 'and', 'of', 'over' or 'the' 3 | 4 | function titleize(title) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /problems/transpose.js: -------------------------------------------------------------------------------- 1 | function transpose(arr) { 2 | 3 | }; 4 | -------------------------------------------------------------------------------- /problems/two_sum.js: -------------------------------------------------------------------------------- 1 | // Write a method, `Array#two_sum`, that finds all pairs of positions where the 2 | // elements at those positions sum to zero. 3 | 4 | // NB: ordering matters. I want each of the pairs to be sorted smaller index 5 | // before bigger index. I want the array of pairs to be sorted 6 | // "dictionary-wise": 7 | // [0, 2] before [1, 2] (smaller first elements come first) 8 | // [0, 1] before [0, 2] (then smaller second elements come first) 9 | 10 | Array.prototype.twoSum = function () { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /solutions/base_converter_solution.js: -------------------------------------------------------------------------------- 1 | function baseConverter(num, b) { 2 | if (num === 0) return ""; 3 | 4 | const digits = [ 5 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 6 | 'a', 'b', 'c', 'd', 'e', 'f' 7 | ]; 8 | 9 | return baseConverter(Math.floor(num/b), b) + digits[num % b]; 10 | }; 11 | -------------------------------------------------------------------------------- /solutions/binary_search_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myBsearch = function(target, func) { 2 | if (this.length === 0) return null; 3 | const mid = Math.floor(this.length / 2); 4 | 5 | if (this[mid] === target) { 6 | return mid; 7 | } else if (this[mid] > target) { 8 | return this.slice(0, mid).myBsearch(target); 9 | } else { 10 | const result = this.slice(mid + 1, this.length).myBsearch(target); 11 | return result === null ? result : mid + 1 + result 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /solutions/bubble_sort_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.bubbleSort = function(func) { 2 | let sorted = false; 3 | 4 | if (!func) { 5 | func = (x, y) => { 6 | if (x <= y) return -1; 7 | return 1; 8 | } 9 | } 10 | 11 | while (!sorted) { 12 | sorted = true; 13 | for (let i = 0; i < this.length; i++) { 14 | if (i + 1 === this.length) continue; 15 | 16 | if (func(this[i], this[i + 1]) === 1) { 17 | sorted = false; 18 | let current = this[i], next = this[i + 1]; 19 | this[i] = next, this[i + 1] = current; 20 | } 21 | } 22 | } 23 | 24 | return this; 25 | } 26 | -------------------------------------------------------------------------------- /solutions/caesar_cipher_solution.js: -------------------------------------------------------------------------------- 1 | function caesarCipher(str, shift) { 2 | const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('') 3 | let encoded = "" 4 | 5 | for (let i = 0; i < str.length; i++) { 6 | if (str[i] === ' ') { 7 | encoded += ' '; 8 | continue 9 | } 10 | 11 | const offset = (alphabet.indexOf(str[i]) + shift) % 26 12 | encoded += alphabet[offset] 13 | } 14 | 15 | return encoded 16 | } 17 | -------------------------------------------------------------------------------- /solutions/deep_dup_solution.js: -------------------------------------------------------------------------------- 1 | function deepDup(arr) { 2 | return arr.map( (el) => el.constructor.name === 'Array' ? deepDup(el) : el); 3 | } 4 | -------------------------------------------------------------------------------- /solutions/digital_root_solution.js: -------------------------------------------------------------------------------- 1 | function digitalRoot(num) { 2 | while (num > 10) { 3 | num = digitalRootStep(num); 4 | } 5 | 6 | return num; 7 | } 8 | 9 | function digitalRootStep(num) { 10 | let root = 0; 11 | 12 | while (num > 0) { 13 | root += num % 10; 14 | num = Math.floor(num/10); 15 | } 16 | 17 | return root; 18 | } 19 | -------------------------------------------------------------------------------- /solutions/doubler_solution.js: -------------------------------------------------------------------------------- 1 | function doubler(array) { 2 | return array.map( el => el * 2 ); 3 | } 4 | -------------------------------------------------------------------------------- /solutions/dups_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.dups = function() { 2 | const count = {}; 3 | const dups = {}; 4 | 5 | this.forEach( (el, idx) => { 6 | count[el] = count[el] || []; 7 | count[el].push(idx); 8 | }); 9 | 10 | const keys = Object.keys(count).filter( el => count[el].length > 1) 11 | keys.forEach( (key) => { 12 | dups[key] = count[key]; 13 | }); 14 | 15 | return dups; 16 | } 17 | -------------------------------------------------------------------------------- /solutions/exponent_solution.js: -------------------------------------------------------------------------------- 1 | function exponent(b, n) { 2 | if (n === 0) return 1; 3 | 4 | if (n > 0) { 5 | return b * exponent(b, n - 1); 6 | } else { 7 | return 1/b * exponent(b, n + 1); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /solutions/factorials_rec_solution.js: -------------------------------------------------------------------------------- 1 | function factorialsRec(num) { 2 | if (num === 1) return [1]; 3 | 4 | const facs = factorialsRec(num - 1); 5 | facs.push(facs[facs.length - 1] * (num - 1)); 6 | return facs; 7 | } 8 | -------------------------------------------------------------------------------- /solutions/factors_solution.js: -------------------------------------------------------------------------------- 1 | function factors(num) { 2 | let factors = Array.from(Array(num)).map( (el, idx) => idx + 1) 3 | return factors.filter( el => num % el === 0); 4 | } 5 | -------------------------------------------------------------------------------- /solutions/fibs_sum_solution.js: -------------------------------------------------------------------------------- 1 | function fibsSum(n) { 2 | if (n === 0) return 0; 3 | if (n === 1) return 1; 4 | 5 | return fibsSum(n - 1) + fibsSum(n - 2) + 1; 6 | } 7 | -------------------------------------------------------------------------------- /solutions/first_even_numbers_sum_solution.js: -------------------------------------------------------------------------------- 1 | function firstEvenNumbersSum(n) { 2 | if (n === 1) return 2; 3 | return 2 * n + firstEvenNumbersSum(n - 1); 4 | } 5 | -------------------------------------------------------------------------------- /solutions/inherits_solution.js: -------------------------------------------------------------------------------- 1 | Function.prototype.inherits = function(Parent) { 2 | function Surrogate() {} 3 | Surrogate.prototype = Parent.prototype; 4 | this.prototype = new Surrogate(); 5 | this.prototype.constructor = this; 6 | }; 7 | -------------------------------------------------------------------------------- /solutions/jumble_sort_solution.js: -------------------------------------------------------------------------------- 1 | function jumbleSort(str, alphabet = null) { 2 | alphabet = alphabet || 'abcdefghijklmnopqrstuvwxyz'.split(''); 3 | str = str.split(''); 4 | 5 | let sorted = false; 6 | while (!sorted) { 7 | sorted = true 8 | for (let i = 0; i < str.length; i++) { 9 | if (i === str.length - 1) break 10 | let current = str[i], next = str[i + 1]; 11 | if (alphabet.indexOf(current) > alphabet.indexOf(next)) { 12 | str[i] = next, str[i + 1] = current; 13 | sorted = false; 14 | } 15 | } 16 | } 17 | 18 | return str.join(''); 19 | } 20 | -------------------------------------------------------------------------------- /solutions/median_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.median = function () { 2 | if (!this.length) return null; 3 | const sorted = this.sort(); 4 | const mid = Math.floor(this.length / 2); 5 | 6 | if (this.length % 2 != 0) { 7 | return sorted[mid]; 8 | } else { 9 | return (sorted[mid] + sorted[mid - 1]) / 2; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /solutions/merge_sort_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.mergeSort = function (func) { 2 | if (this.length <= 1) return this; 3 | 4 | if (!func) func = (left, right) => { 5 | return left < right ? -1 : left > right ? 1 : 0; 6 | } 7 | 8 | const midpoint = Math.floor(this.length / 2); 9 | const sortedLeft = this.slice(0, midpoint).mergeSort(func); 10 | const sortedRight = this.slice(midpoint).mergeSort(func); 11 | 12 | return sortedLeft.merge(sortedRight, func); 13 | } 14 | 15 | Array.prototype.merge = function (arr, func) { 16 | let merged = []; 17 | 18 | while (this.length && arr.length) { 19 | switch(func(this[0], arr[0])) { 20 | case -1: 21 | merged.push(this.shift()); 22 | break 23 | case 0: 24 | merged.push(this.shift()); 25 | break 26 | case 1: 27 | merged.push(arr.shift()); 28 | break 29 | } 30 | } 31 | 32 | merged = merged.concat(this); 33 | merged = merged.concat(arr); 34 | 35 | return merged; 36 | } 37 | -------------------------------------------------------------------------------- /solutions/my_apply_solution.js: -------------------------------------------------------------------------------- 1 | Function.prototype.myApply = function (ctx, ...args) { 2 | return this.bind(ctx, ...args)(); 3 | }; 4 | -------------------------------------------------------------------------------- /solutions/my_bind_solution.js: -------------------------------------------------------------------------------- 1 | Function.prototype.myBind = function (ctx, ...bindArgs) { 2 | return (...callArgs) => { 3 | return this.apply(ctx, bindArgs.concat(callArgs)); 4 | }; 5 | }; 6 | -------------------------------------------------------------------------------- /solutions/my_call_solution.js: -------------------------------------------------------------------------------- 1 | Function.prototype.myCall = function (ctx, ...args) { 2 | return this.bind(ctx, ...args)(); 3 | }; 4 | -------------------------------------------------------------------------------- /solutions/my_curry_solution.js: -------------------------------------------------------------------------------- 1 | Function.prototype.myCurry = function (numArgs) { 2 | let argBalls = []; 3 | let fcn = this; 4 | return function _myCurry (el) { 5 | argBalls.push(el); 6 | if (argBalls.length < numArgs) { 7 | return _myCurry; 8 | } else { 9 | return fcn(...argBalls); 10 | } 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /solutions/my_each_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myEach = function (func) { 2 | for (let i = 0; i < this.length; i++) { 3 | func(this[i]); 4 | } 5 | 6 | return this; 7 | } 8 | -------------------------------------------------------------------------------- /solutions/my_every_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myEvery = function (func) { 2 | for (let i = 0; i < this.length; i++) { 3 | if (!func(this[i])) return false; 4 | } 5 | 6 | return true 7 | } 8 | -------------------------------------------------------------------------------- /solutions/my_filter_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myFilter = function (func) { 2 | const selection = []; 3 | this.forEach( (el) => { 4 | if (func(el)) selection.push(el); 5 | }); 6 | 7 | return selection; 8 | } 9 | -------------------------------------------------------------------------------- /solutions/my_find_solution.js: -------------------------------------------------------------------------------- 1 | function myFind (array, callback) { 2 | for (let i = 0; i < array.length; i++) { 3 | if (callback(array[i])) { 4 | return array[i]; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /solutions/my_flatten_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.flatten = function () { 2 | let flattened = []; 3 | 4 | this.forEach( (el) => { 5 | if (el instanceof Array) { 6 | flattened = flattened.concat(el.flatten()); 7 | } else { 8 | flattened.push(el); 9 | } 10 | }); 11 | 12 | return flattened; 13 | } 14 | -------------------------------------------------------------------------------- /solutions/my_inject_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myReduce = function (callback, acc) { 2 | const array = this.slice(0); 3 | if (!acc) acc = array.shift(); 4 | 5 | for (let i = 0; i < array.length; i++) { 6 | acc = callback(acc, array[i]) 7 | } 8 | 9 | return acc 10 | } 11 | -------------------------------------------------------------------------------- /solutions/my_join_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myJoin = function (separator = '') { 2 | let newString = '' 3 | 4 | this.forEach( (el, idx) => { 5 | newString += `${el}`; 6 | if (idx < this.length - 1) newString += separator; 7 | }) 8 | 9 | return newString; 10 | } 11 | -------------------------------------------------------------------------------- /solutions/my_reject_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.reject = function (func) { 2 | const selection = []; 3 | 4 | for (let i = 0; i < this.length; i++) { 5 | if (!func(this[i])) selection.push(this[i]); 6 | } 7 | 8 | return selection; 9 | } 10 | -------------------------------------------------------------------------------- /solutions/my_reverse_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.myReverse = function () { 2 | const dup = this.slice(0) 3 | for (let i = 1; i < this.length + 1; i++) { 4 | this[i - 1] = dup[this.length - i]; 5 | } 6 | 7 | return this; 8 | } 9 | -------------------------------------------------------------------------------- /solutions/my_rotate_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.rotate = function (times = 1) { 2 | let rotations; 3 | const rotated = this.slice(0); 4 | 5 | if (times < 0) rotations = this.length % (Math.abs(times) / this.length); 6 | else rotations = times % this.length; 7 | 8 | for (let i = 0; i < rotations; i++) { 9 | rotated.push(rotated.shift()) 10 | } 11 | 12 | return rotated; 13 | } 14 | -------------------------------------------------------------------------------- /solutions/my_slice_solution.js: -------------------------------------------------------------------------------- 1 | String.prototype.mySlice = function(start, end) { 2 | let slice = ""; 3 | 4 | if (typeof end === 'undefined') { 5 | end = this.length; 6 | } 7 | 8 | for (let i = start; i < end && i < this.length; i++) { 9 | slice += this[i]; 10 | } 11 | return slice; 12 | }; 13 | -------------------------------------------------------------------------------- /solutions/my_some_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.mySome = function (func) { 2 | for (let i = 0; i < this.length; i++) { 3 | if (func(this[i])) return true; 4 | } 5 | 6 | return false; 7 | } 8 | -------------------------------------------------------------------------------- /solutions/permutations_solution.js: -------------------------------------------------------------------------------- 1 | function permutations(array) { 2 | let result = []; 3 | 4 | const permute = (arr, m = []) => { 5 | if (arr.length === 0) { 6 | result.push(m) 7 | } else { 8 | for (let i = 0; i < arr.length; i++) { 9 | let curr = arr.slice(); 10 | let next = curr.splice(i, 1); 11 | permute(curr.slice(), m.concat(next)) 12 | } 13 | } 14 | 15 | return result; 16 | } 17 | return permute(array); 18 | } 19 | -------------------------------------------------------------------------------- /solutions/pig_latinify_solution.js: -------------------------------------------------------------------------------- 1 | function pigLatinify(sentence) { 2 | const words = sentence.split(' ') 3 | const translateWord = (word) => { 4 | vowels = 'aeiou'.split(''); 5 | if (vowels.indexOf(word[0]) != -1) { 6 | return `${word}ay`; 7 | } else { 8 | let phonemeEnd = 0; 9 | while(!(vowels.indexOf(word[phonemeEnd]) != -1)) { 10 | phonemeEnd += 1; 11 | } 12 | 13 | if (word[phonemeEnd - 1] === 'q') phonemeEnd += 1; 14 | return `${word.slice(phonemeEnd)}${word.slice(0, phonemeEnd)}ay`; 15 | } 16 | } 17 | 18 | return words.map( word => translateWord(word) ).join(' '); 19 | } 20 | -------------------------------------------------------------------------------- /solutions/prime_factorization_solution.js: -------------------------------------------------------------------------------- 1 | function primeFactorization(num) { 2 | if (num === 1) return []; 3 | const upperRange = Math.ceil(Math.sqrt(num)); 4 | 5 | for (let i = 2; i <= upperRange; i++) { 6 | if (num % i == 0) { 7 | let factors = [i].concat(primeFactorization(Math.floor(num / i))); 8 | return factors; 9 | } 10 | } 11 | 12 | return [num]; 13 | } 14 | -------------------------------------------------------------------------------- /solutions/primes_solution.js: -------------------------------------------------------------------------------- 1 | function primes(count) { 2 | const primes = []; 3 | let i = 2; 4 | 5 | const isPrime = (num) => { 6 | for (var i = 2; i < num; i++) { 7 | if (num % i === 0) return false; 8 | } 9 | 10 | return true; 11 | } 12 | 13 | while (primes.length < count) { 14 | if (isPrime(i)) primes.push(i); 15 | i += 1; 16 | } 17 | 18 | return primes; 19 | } 20 | -------------------------------------------------------------------------------- /solutions/quicksort_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.quickSort = function (func) { 2 | if (this.length < 2) return this; 3 | 4 | if (!func) { 5 | func = (x, y) => { 6 | if (x < y) return - 1; 7 | return 1; 8 | } 9 | } 10 | 11 | const pivot = this[0]; 12 | let left = this.slice(1).filter( (el) => func(el, pivot) === -1); 13 | let right = this.slice(1).filter( (el) => func(el, pivot) != -1); 14 | left = left.quicksort(func); 15 | right = right.quicksort(func); 16 | 17 | return left.concat([pivot]).concat(right); 18 | } 19 | -------------------------------------------------------------------------------- /solutions/real_words_in_string_solution.js: -------------------------------------------------------------------------------- 1 | String.prototype.realWordsInString = function (dictionary) { 2 | realWords = []; 3 | for (let i = 0; i < this.length; i++) { 4 | let first = i 5 | for (let j = 0; j < this.length; j++) { 6 | let last = j 7 | let word = this.slice(first, last); 8 | 9 | if (dictionary.indexOf(word) > -1) { 10 | if (realWords.indexOf(word) < 0) realWords.push(word); 11 | } 12 | } 13 | } 14 | 15 | return realWords; 16 | } 17 | 18 | // Brian solution 19 | String.prototype._realWordsInString = function(dictionary) { 20 | realWords = []; 21 | 22 | dictionary.forEach( (el) => { 23 | if (string.includes(el)) result.push(el); 24 | }); 25 | return result.sort(); 26 | } 27 | -------------------------------------------------------------------------------- /solutions/rec_sum_solution.js: -------------------------------------------------------------------------------- 1 | function recSum(nums) { 2 | if (!nums.length) return 0; 3 | return nums[0] + recSum(nums.splice(1)); 4 | } 5 | -------------------------------------------------------------------------------- /solutions/string_include_key_solution.js: -------------------------------------------------------------------------------- 1 | function stringIncludeKey(string, key) { 2 | if (!key.length) return true; 3 | 4 | let nextKeyChar = key[0]; 5 | let keyIndex = string.indexOf(nextKeyChar); 6 | 7 | if (keyIndex < 0) return false; 8 | return stringIncludeKey(string.slice(keyIndex + 1), key.slice(1)) 9 | } 10 | -------------------------------------------------------------------------------- /solutions/subsets_solution.js: -------------------------------------------------------------------------------- 1 | function subsets(arr) { 2 | if (!arr.length) return [[]]; 3 | const last = arr[arr.length - 1]; 4 | const subs = subsets(arr.slice(0, arr.length - 1)); 5 | return subs.concat(subs.map( (el) => { 6 | let newArr = el.slice(0) 7 | newArr.push(last); 8 | return newArr; 9 | })); 10 | } 11 | -------------------------------------------------------------------------------- /solutions/symmetric_substrings_solution.js: -------------------------------------------------------------------------------- 1 | String.prototype.symmetricSubstrings = function () { 2 | const symmetric = []; 3 | 4 | for (let i = 0; i < this.length; i++) { 5 | for (let j = 2; j <= this.length - i; j++) { 6 | const subst = this.slice(i, i + j); 7 | const reversed = subst.split('').reverse().join('') 8 | 9 | if (subst === reversed) symmetric.push(subst); 10 | } 11 | } 12 | 13 | return symmetric; 14 | } 15 | -------------------------------------------------------------------------------- /solutions/titleize_solution.js: -------------------------------------------------------------------------------- 1 | function titleize(title) { 2 | const littleWords = ['and', 'the', 'over']; 3 | 4 | const words = title.split(' '); 5 | const titleizedWords = words.map( (word, idx) => { 6 | if (idx != 0 && littleWords.indexOf(word) >= 0) { 7 | return word.toLowerCase(); 8 | } else { 9 | return word.slice(0, 1).toUpperCase() + word.slice(1); 10 | } 11 | }) 12 | 13 | return titleizedWords.join(' '); 14 | } 15 | -------------------------------------------------------------------------------- /solutions/transpose_solution.js: -------------------------------------------------------------------------------- 1 | const transpose = function (arr) { 2 | let transposedArr = []; 3 | let currRow; 4 | 5 | for (var col = 0; col < arr[0].length; col++) { 6 | transposedRow = []; 7 | for (var row = 0; row < arr.length; row++) { 8 | transposedRow.push(arr[row][col]); 9 | } 10 | transposedArr.push(transposedRow); 11 | } 12 | return transposedArr; 13 | }; 14 | -------------------------------------------------------------------------------- /solutions/two_sum_solution.js: -------------------------------------------------------------------------------- 1 | Array.prototype.twoSum = function () { 2 | const pairs = []; 3 | for (var i = 0; i < this.length - 1; i++) { 4 | for (var j = i + 1; j < this.length; j++) { 5 | if (this[i] + this[j] === 0) pairs.push([i, j]); 6 | } 7 | } 8 | 9 | return pairs; 10 | } 11 | -------------------------------------------------------------------------------- /specs/base_converter_spec.js: -------------------------------------------------------------------------------- 1 | describe('baseConverter', () => { 2 | it('converts a small number in binary', () => { 3 | expect(baseConverter(5, 2)).toEqual('101'); 4 | }); 5 | 6 | it('converts a large number into base 15', () => { 7 | expect(baseConverter(1239449, 16)).toEqual('12e999' || '12E999'); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /specs/binary_search_spec.js: -------------------------------------------------------------------------------- 1 | describe("my_bsearch", () => { 2 | it("finds the first element in the array", () => { 3 | expect([1, 2, 3].myBsearch(1)).toEqual(0); 4 | }); 5 | 6 | it("finds an element for an array with an even number of elements", () => { 7 | expect([2, 3, 4, 5].myBsearch(3)).toEqual(1); 8 | }); 9 | 10 | it("finds an element for an array with an odd number of elements", () => { 11 | expect([2, 4, 6, 8, 10].myBsearch(6)).toEqual(2); 12 | }); 13 | 14 | it("finds an element in the second half of the array (even)", () => { 15 | expect([1, 3, 4, 5, 9].myBsearch(5)).toEqual(3); 16 | }); 17 | 18 | it("finds an element in the second half of the array (odd)", () => { 19 | expect([1, 2, 3, 4, 5, 6].myBsearch(6)).toEqual(5); 20 | }); 21 | 22 | it("Returns nil if the element is not in the array (smaller)", () => { 23 | expect([1, 2, 3, 4, 5, 6].myBsearch(0)).toEqual(null); 24 | }); 25 | 26 | it("Returns null if the element is not in the array (bigger)", () => { 27 | expect([1, 2, 3, 4, 5, 7].myBsearch(6)).toEqual(null); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /specs/bubble_sort_spec.js: -------------------------------------------------------------------------------- 1 | describe("#bubbleSort", () => { 2 | beforeEach(() => { 3 | array = [3, 1, 5, 4, 2]; 4 | }) 5 | 6 | it("works with an empty array", () => { 7 | expect([].bubbleSort().join()).toEqual([].join()); 8 | }); 9 | 10 | it("works with an array of one item", () => { 11 | expect([1].bubbleSort().join('')).toEqual([1].join('')); 12 | }) 13 | 14 | it("sorts numbers", () => { 15 | expect(array.bubbleSort().join('')).toEqual(array.sort().join('')); 16 | }); 17 | 18 | it("does not modify the original array", () => { 19 | const sortedArray = array.bubbleSort() 20 | expect(sortedArray).not.toEqual(array); 21 | }) 22 | 23 | it("will use a callback if given", () => { 24 | const descendSort = (x, y) => { 25 | if (x > y) return -1; 26 | return 1; 27 | } 28 | 29 | let sorted = array.bubbleSort(descendSort) 30 | expect(sorted.join('')).toEqual([5, 4, 3, 2, 1].join('')); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /specs/caesar_cipher_spec.js: -------------------------------------------------------------------------------- 1 | describe("#caesarCipher", () => { 2 | it("encodes a simple word", () => { 3 | expect(caesarCipher("aaa", 11)).toEqual("lll"); 4 | }); 5 | 6 | it("wraps around the alphabet", () => { 7 | expect(caesarCipher("zzz", 1)).toEqual("aaa"); 8 | }); 9 | 10 | it("encodes multiple words", () => { 11 | expect(caesarCipher("catz hatz", 2)).toEqual("ecvb jcvb"); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /specs/deep_dup_spec.js: -------------------------------------------------------------------------------- 1 | describe("deepDup", () => { 2 | beforeEach( () => { 3 | robotParts = [ 4 | ["nuts", "bolts", "washers"], 5 | ["capacitors", "resistors", "inductors"] 6 | ]; 7 | 8 | copy = deepDup(robotParts); 9 | }); 10 | 11 | it("makes a copy of the original array", () => { 12 | expect(copy).toEqual(robotParts); 13 | }); 14 | 15 | it("deeply copies arrays", () => { 16 | copy[1].push("LEDs"); 17 | expect(robotParts[1]).toEqual(["capacitors", "resistors", "inductors"]); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /specs/digital_root_spec.js: -------------------------------------------------------------------------------- 1 | describe("#digitalRoot", () => { 2 | it("calculates the digital root of a single-digit number", () => { 3 | expect(digitalRoot(9)).toEqual(9); 4 | }); 5 | 6 | it("calculates the digital root of a larger number", () => { 7 | expect(digitalRoot(4322)).toEqual(2); 8 | }); 9 | // 10 | // it("does not call #to_s on the argument", () => { 11 | // expect_any_instance_of(Fixnum).to_not receive(:to_s) 12 | // digitalRoot(4322); 13 | // }); 14 | }); 15 | -------------------------------------------------------------------------------- /specs/doubler_spec.js: -------------------------------------------------------------------------------- 1 | describe("#doubler", () => { 2 | beforeEach(() => { 3 | array = [1, 2, 3]; 4 | }); 5 | 6 | it("doubles the elements of the array", () => { 7 | expect(doubler(array)).toEqual([2, 4, 6]); 8 | }); 9 | 10 | it("does not modify the original array", () => { 11 | const dupArray = array.slice(0); 12 | 13 | doubler(array); 14 | 15 | expect(array).toEqual(dupArray); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /specs/dups_spec.js: -------------------------------------------------------------------------------- 1 | describe("#dups", () => { 2 | it("solves a simple example", () => { 3 | expect([1, 3, 0, 1].dups()).toEqual({ 1: [0, 3] }); 4 | }); 5 | 6 | it("finds two dups", () => { 7 | expect([1, 3, 0, 3, 1].dups()).toEqual({ 1: [0, 4], 3: [1, 3] }); 8 | }); 9 | 10 | it("finds multi-dups", () => { 11 | expect([1, 3, 4, 3, 0, 3].dups()).toEqual({ 3: [1, 3, 5] }); 12 | }); 13 | 14 | it("returns {} when no dups found", () => { 15 | expect([1, 3, 4, 5].dups()).toEqual({}); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /specs/exponent_spec.js: -------------------------------------------------------------------------------- 1 | describe("exponent", () => { 2 | it("correctly handles positive powers", () => { 3 | expect(exponent(5, 3)).toEqual(125); 4 | }); 5 | 6 | it("correctly handles negative powers", () => { 7 | expect(exponent(2, -3)).toEqual(1/8.0); 8 | }); 9 | 10 | it("correctly handles 0", () => { 11 | expect(exponent(2, 0)).toEqual(1); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /specs/factorials_rec_spec.js: -------------------------------------------------------------------------------- 1 | describe("#factorialsRec", () => { 2 | it("returns first factorial number", () => { 3 | expect(factorialsRec(1)).toEqual([1]); 4 | }); 5 | 6 | it("returns first two factorial numbers", () => { 7 | expect(factorialsRec(2)).toEqual([1, 1]) 8 | }); 9 | 10 | it("returns many factorials numbers", () => { 11 | expect(factorialsRec(6)).toEqual([1, 1, 2, 6, 24, 120]); 12 | }); 13 | 14 | // it("calls itself recursively", () => { 15 | // // this should enforce you calling your method recursively. 16 | // 17 | // expect(self).to receive(:factorialsRec).at_least(:twice).and_call_original 18 | // factorialsRec(6) 19 | // }); 20 | }); 21 | -------------------------------------------------------------------------------- /specs/factors_spec.js: -------------------------------------------------------------------------------- 1 | describe("#factors", () => { 2 | it("returns the factors of 10 in order", () => { 3 | expect(factors(10)).toEqual([1, 2, 5, 10]); 4 | }); 5 | 6 | it("returns just two factors for primes", () => { 7 | expect(factors(13)).toEqual([1, 13]); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /specs/fibs_sum_spec.js: -------------------------------------------------------------------------------- 1 | describe('fibsSum', () => { 2 | it('It correctly gets the answer for the 1st fibonacci number', () => { 3 | expect(fibsSum(1)).toEqual(1); 4 | }); 5 | 6 | it('It correctly gets the answer for the first 2 fibonacci numbers', () => { 7 | expect(fibsSum(2)).toEqual(2); 8 | }); 9 | 10 | it('It correctly gets the answer for the first 6 fibonacci numbers', () => { 11 | expect(fibsSum(6)).toEqual(20); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /specs/first_even_numbers_sum_spec.js: -------------------------------------------------------------------------------- 1 | describe('firstEvenNumbersSum', () => { 2 | it("Correctly returns the sum of the first even number", () => { 3 | expect(firstEvenNumbersSum(1)).toEqual(2); 4 | }); 5 | 6 | it("Returns the sum of the first n even numbers", () => { 7 | expect(firstEvenNumbersSum(6)).toEqual(42); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /specs/inherits_spec.js: -------------------------------------------------------------------------------- 1 | describe("inherits", () => { 2 | let Animal, Dog, dog; 3 | 4 | beforeEach(() => { 5 | Animal = function() { 6 | this.name = "Yogi"; 7 | }; 8 | 9 | Animal.prototype.makeNoise = function() { return "Hi!"; }; 10 | 11 | Dog = function() { 12 | this.age = 7; 13 | }; 14 | 15 | Dog.inherits(Animal); 16 | 17 | Dog.prototype.bark = function() { return "Woof!"; }; 18 | 19 | dog = new Dog(); 20 | }); 21 | 22 | it("should properly set up the prototype chain between a child and parent", () => { 23 | expect(dog.bark()).toBe("Woof!"); 24 | expect(dog.makeNoise()).toBe("Hi!"); 25 | }); 26 | 27 | it("should not call the parent's constructor function", () => { 28 | expect(dog.name).toBeUndefined(); 29 | }); 30 | 31 | it("should maintain separation of parent and child prototypes", () => { 32 | Dog.prototype.someProperty = 42; 33 | const animal = new Animal(); 34 | expect(animal.someProperty).toBeUndefined(); 35 | expect(animal.makeNoise()).toBe("Hi!"); 36 | }); 37 | 38 | it("should properly work for longer inheritance chains", () => { 39 | const Poodle = function () { this.name = "Bill"; }; 40 | 41 | Poodle.inherits(Dog); 42 | 43 | Poodle.prototype.shave = function() { return "Brrr."; }; 44 | 45 | const poodle = new Poodle(); 46 | expect(poodle.name).toBe("Bill"); 47 | expect(poodle.shave()).toBe("Brrr."); 48 | expect(poodle.makeNoise()).toBe("Hi!"); 49 | expect(poodle.bark()).toBe("Woof!"); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /specs/jumble_sort_spec.js: -------------------------------------------------------------------------------- 1 | describe("#jumbleSort", () => { 2 | it("defaults to alphabetical order", () => { 3 | expect(jumbleSort("hello")).toEqual("ehllo"); 4 | }); 5 | 6 | it("takes an alphabet array and sorts by that order", () => { 7 | const alphabet = 'helo'.split(''); 8 | 9 | expect(jumbleSort("hello", alphabet)).toEqual("hello"); 10 | }); 11 | 12 | it("sorts by a reversed alphabet", () => { 13 | reverse = 'abcdefghijklmnopqrstuvwxyz'.split('').reverse().join('') 14 | expect(jumbleSort("hello", reverse)).toEqual("ollhe"); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /specs/median_spec.js: -------------------------------------------------------------------------------- 1 | describe("#median", () => { 2 | beforeEach(() => { 3 | evenArray = [3, 2, 6, 7]; 4 | oddArray = [3, 2, 6, 7, 1]; 5 | }); 6 | 7 | it("returns null for the empty array", () => { 8 | expect([].median()).toBe(null); 9 | }); 10 | 11 | it("returns the element for an array of length 1", () => { 12 | expect([1].median()).toEqual(1); 13 | }); 14 | 15 | it("returns the median of an odd-length array", () => { 16 | expect(oddArray.median()).toEqual(3); 17 | }); 18 | 19 | it("returns the median of an even-length array", () => { 20 | expect(evenArray.median()).toEqual(4.5); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /specs/merge_sort_spec.js: -------------------------------------------------------------------------------- 1 | describe("#mergeSort", () => { 2 | beforeEach( () => { 3 | array = [3, 1, 2, 5, 4]; 4 | }); 5 | 6 | it("works with an empty array", () => { 7 | expect([].mergeSort()).toEqual([]); 8 | }); 9 | 10 | it("works with an array of one item", () => { 11 | expect([1].mergeSort()).toEqual([1]); 12 | }); 13 | 14 | it("sorts numbers", () => { 15 | expect(array.mergeSort()).toEqual(array.sort()); 16 | }); 17 | 18 | it("will use callback if given", () => { 19 | const callback = (x, y) => { 20 | if (y < x) return -1; 21 | return 1; 22 | }; 23 | const reversed = array.mergeSort(callback); 24 | expect(reversed).toEqual([5, 4, 3, 2, 1]) 25 | }); 26 | 27 | it("does not modify original", () => { 28 | dupArray = array.slice(0); 29 | dupArray.mergeSort(); 30 | expect(dupArray).toEqual(array); 31 | }); 32 | // 33 | // it("calls the merge helper method", () => { 34 | // expect(Array).to receive(:merge).at_least(:once).and_call_original 35 | // array.mergeSort() 36 | // }); 37 | }); 38 | -------------------------------------------------------------------------------- /specs/my_bind_spec.js: -------------------------------------------------------------------------------- 1 | describe("Function.prototype.myBind", () => { 2 | // let Cat; 3 | let sally, markov, curie; 4 | 5 | beforeEach(() => { 6 | class Cat { 7 | constructor (name) { 8 | this.name = name; 9 | } 10 | 11 | sayHello () { 12 | return this.name + " says hello!"; 13 | } 14 | 15 | greetOne (otherCat) { 16 | return this.name + " says hello to " + otherCat.name; 17 | } 18 | 19 | greetTwo (otherCat1, otherCat2) { 20 | return this.name + " says hello to " + otherCat1.name + " and " + 21 | otherCat2.name; 22 | } 23 | } 24 | 25 | sally = new Cat("Sally"); 26 | markov = new Cat("Markov"); 27 | curie = new Cat("Curie"); 28 | }); 29 | 30 | it("should call the function method style on the context", () => { 31 | expect(sally.sayHello.myBind(sally)()).toEqual("Sally says hello!"); 32 | }); 33 | 34 | it("should pass in bind-time argument to the method", () => { 35 | expect(sally.greetOne.myBind(sally, markov)()) 36 | .toEqual("Sally says hello to Markov"); 37 | }); 38 | 39 | it("should pass in two bind-time arguments to the method", () => { 40 | expect(sally.greetTwo.myBind(sally, markov, curie)()) 41 | .toEqual("Sally says hello to Markov and Curie"); 42 | }); 43 | 44 | it("should combine bind-time and call-time arguments", () => { 45 | expect(sally.greetTwo.myBind(sally, markov)(curie)) 46 | .toEqual("Sally says hello to Markov and Curie"); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /specs/my_call_spec.js: -------------------------------------------------------------------------------- 1 | describe("Function.prototype.myCall", () => { 2 | beforeEach(() => { 3 | class Cat { 4 | constructor (name) { 5 | this.name = name; 6 | } 7 | 8 | sayHello () { 9 | return this.name + " says hello!"; 10 | } 11 | 12 | greetOne (otherCat) { 13 | return this.name + " says hello to " + otherCat.name; 14 | } 15 | 16 | greetTwo (otherCat1, otherCat2) { 17 | return this.name + " says hello to " + otherCat1.name + " and " + 18 | otherCat2.name; 19 | } 20 | } 21 | 22 | sally = new Cat("Sally"); 23 | markov = new Cat("Markov"); 24 | curie = new Cat("Curie"); 25 | }); 26 | 27 | it("invokes the function it is called on", () => { 28 | expect(sally.greetOne.myCall(sally, markov)).toEqual("Sally says hello to Markov"); 29 | }); 30 | 31 | it("can take any number of arguments", () => { 32 | expect(sally.greetTwo.myCall(sally, markov, curie)) 33 | .toEqual("Sally says hello to Markov and Curie"); 34 | }); 35 | it("does not use the 'call' function", () => { 36 | spyOn(Function.prototype, "call").and.callThrough(); 37 | 38 | sally.greetTwo.myCall(sally, markov, curie); 39 | const count = Function.prototype.call.calls.count() 40 | expect(count).toBeLessThan(1); 41 | }); 42 | 43 | it("should call the function method style on the context", () => { 44 | expect(sally.sayHello.myCall(markov)).toEqual("Markov says hello!"); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /specs/my_curry_spec.js: -------------------------------------------------------------------------------- 1 | describe("Function.prototype.myCurry", () => { 2 | const adder = function (...argBalls) { 3 | return argBalls.reduce((a, b) => { 4 | return a + b; 5 | }, 0); 6 | } 7 | const addObj = { adder }; 8 | 9 | 10 | it("collects up arguments until there are numArgs of them", () => { 11 | expect(adder.myCurry(3)(1)(2)(3)).toEqual(6); 12 | }); 13 | 14 | it("should return itself if there are too few arguments still", () => { 15 | const myCurryResult = adder.myCurry(3)(1)(2); 16 | expect(myCurryResult).not.toEqual(6); 17 | expect(typeof(myCurryResult)).toEqual("function"); 18 | }); 19 | 20 | it("should call the original function", () => { 21 | spyOn(addObj, "adder"); 22 | 23 | addObj.adder.myCurry(3)(1)(2)(3); 24 | expect(addObj.adder).toHaveBeenCalled(); 25 | }); 26 | 27 | }); 28 | -------------------------------------------------------------------------------- /specs/my_each_spec.js: -------------------------------------------------------------------------------- 1 | describe("myEach", () => { 2 | beforeEach( () => { 3 | callback = x => res.push(2 * x); 4 | array = [1, 2, 3]; 5 | }); 6 | 7 | it("it passes each element into a callback", () => { 8 | res = []; 9 | array.myEach(callback); 10 | expect(res).toEqual([2,4,6]); 11 | }); 12 | 13 | it("returns the original array", () => { 14 | expect(array.myEach(callback)).toEqual([1, 2, 3]); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /specs/my_every_spec.js: -------------------------------------------------------------------------------- 1 | describe('myEvery', () => { 2 | beforeEach( () => { 3 | a = [2, 4, 6]; 4 | }); 5 | 6 | it("returns true if all elements match the block", () => { 7 | const callback = x => x % 2 === 0; 8 | expect(a.myEvery(callback)).toBe(true); 9 | }); 10 | 11 | it("returns false if not all elementes match the block", () => { 12 | const callback = x => x % 3 === 0; 13 | expect(a.myEvery(callback)).toBe(false); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /specs/my_filter_spec.js: -------------------------------------------------------------------------------- 1 | describe('myFilter', () => { 2 | beforeEach( () => { 3 | a = [1, 2, 3]; 4 | }); 5 | 6 | it('It correctly selects elements according to the passed in block', () => { 7 | const callback = x => x > 1; 8 | expect(a.myFilter(callback)).toEqual([2, 3]); 9 | }); 10 | 11 | it('It returns an empty array if there are no matches', () => { 12 | const callback = x => x === 4; 13 | expect(a.myFilter(callback)).toEqual([]); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /specs/my_find_spec.js: -------------------------------------------------------------------------------- 1 | describe("myFind", () => { 2 | let arr, spy; 3 | beforeEach(() => { 4 | arr = [1, 2, 3]; 5 | spy = { 6 | callback: (el) => false 7 | }; 8 | }); 9 | 10 | const equalsThree = (el) => el === 3; 11 | const equalsFour = (el) => el === 4; 12 | 13 | it("calls the callback passed to it", () => { 14 | spyOn(spy, "callback"); 15 | 16 | myFind(arr, spy.callback); 17 | 18 | expect(spy.callback).toHaveBeenCalled(); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /specs/my_flatten_spec.js: -------------------------------------------------------------------------------- 1 | describe("flatten", () => { 2 | it('Flattens arrays correctly', () => { 3 | const array = [1, 2, 3, [4, [5, 6]], [[[7]], 8]]; 4 | expect(array.flatten()).toEqual([1, 2, 3, 4, 5, 6, 7, 8]); 5 | }); 6 | }); 7 | -------------------------------------------------------------------------------- /specs/my_inject_spec.js: -------------------------------------------------------------------------------- 1 | describe('Array#myReduce', () => { 2 | let myArray; 3 | const noOp = (accum, el) => accum; 4 | 5 | const spy = { 6 | sum: (accum, el) => accum + el 7 | }; 8 | 9 | it("calls the callback, passing in the accumulator and each element", () => { 10 | myArray = [1, 2, 3]; 11 | spyOn(spy, "sum").and.callThrough(); 12 | 13 | myArray.myReduce(spy.sum); 14 | 15 | expect(spy.sum).toHaveBeenCalledWith(1, 2); 16 | expect(spy.sum).toHaveBeenCalledWith(3, 3); 17 | }); 18 | 19 | it("works with a sum callback", () => { 20 | myArray = [1, 2, 3, 4]; 21 | expect(myArray.myReduce(spy.sum)).toEqual(10); 22 | }); 23 | 24 | it("works with a multiplier callback", () => { 25 | myArray = [4, 4, 4]; 26 | const times = (accum, el) => accum * el; 27 | 28 | expect(myArray.myReduce(times)).toEqual(64); 29 | }); 30 | 31 | it("uses the first item as the accumulator", () => { 32 | myArray = [1, 2, 3, 4]; 33 | expect(myArray.myReduce(noOp)).toEqual(1); 34 | }); 35 | 36 | it("does not call Array.prototype.reduce", () => { 37 | myArray = [1, 2, 3, 4]; 38 | spyOn(myArray, "reduce"); 39 | 40 | myArray.myReduce(spy.sum); 41 | 42 | expect(myArray.reduce).not.toHaveBeenCalled(); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /specs/my_join_spec.js: -------------------------------------------------------------------------------- 1 | describe("myJoin", () => { 2 | beforeEach( () => { 3 | const a = ['a', 'b', 'c', 'd']; 4 | }); 5 | 6 | it("joins an array if no argument is passed", () => { 7 | expect(a.myJoin()).toEqual("abcd") 8 | }); 9 | 10 | it("joins an array if an argument is passed", () => { 11 | expect(a.myJoin("$")).toEqual("a$b$c$d") 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /specs/my_reject_spec.js: -------------------------------------------------------------------------------- 1 | describe('reject', () => { 2 | beforeEach( () => { 3 | a = [1, 2, 3]; 4 | }); 5 | 6 | it('it returns elements that do not match the passed in block', () => { 7 | const callback = x => x > 1; 8 | expect(a.reject(callback)).toEqual([1]); 9 | }); 10 | 11 | it('It returns all elements if no elements match the block', () => { 12 | const callback = x => x === 4; 13 | expect(a.reject(callback)).toEqual([1,2,3]); 14 | }); 15 | 16 | }); 17 | -------------------------------------------------------------------------------- /specs/my_reverse_spec.js: -------------------------------------------------------------------------------- 1 | describe("myReverse", () => { 2 | beforeEach( () => { 3 | a = [ "a", "b", "c", "d" ]; 4 | }); 5 | 6 | it("Reverses an array", () => { 7 | expect(a.myReverse()).toEqual(a.reverse()) 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /specs/my_rotate_spec.js: -------------------------------------------------------------------------------- 1 | describe("rotate", () => { 2 | a = [ "a", "b", "c", "d" ] 3 | 4 | it("Rotates the elements 1 position if no argument is passed in", () => { 5 | expect(a.rotate()).toEqual(["b", "c", "d", "a"]); 6 | }); 7 | 8 | it("Rotates the elements correctly if an argument is passed in", () => { 9 | expect(a.rotate(2)).toEqual(["c", "d", "a", "b"]); 10 | }); 11 | 12 | it("Rotates the elements correctly if a negative argument is passed in", () => { 13 | expect(a.rotate(-3)).toEqual(["b", "c", "d", "a"]); 14 | }); 15 | 16 | it("Rotates the elements correctly for a large argument", () => { 17 | expect(a.rotate(15)).toEqual(["d", "a", "b", "c"]); 18 | }); 19 | 20 | }); 21 | -------------------------------------------------------------------------------- /specs/my_slice_spec.js: -------------------------------------------------------------------------------- 1 | describe("String.prototype.mySlice", () => { 2 | it("slices the string from the start index to the end index", () => { 3 | expect("abcd".mySlice(0, 2)).toEqual("ab"); 4 | }); 5 | 6 | it("slices to the end of the string when no second argument is passed", () => { 7 | expect("foobar".mySlice(3)).toEqual("bar"); 8 | }); 9 | 10 | it("returns an empty string when the first argument is higher", () => { 11 | expect("empty!".mySlice(1, 0)).toEqual(""); 12 | }); 13 | 14 | it("slices to the end of the string when the end index is greater than the string's length", () => { 15 | expect("super long string".mySlice(0, 200)).toEqual("super long string"); 16 | }); 17 | 18 | it("doesn't call `substr`, `slice`, or `substring`", () => { 19 | const str = new String("don't you do it!"); 20 | spyOn(str, "substr"); 21 | spyOn(str, "slice"); 22 | spyOn(str, "substring"); 23 | 24 | str.mySlice(0); 25 | 26 | expect(str.substr).not.toHaveBeenCalled(); 27 | expect(str.slice).not.toHaveBeenCalled(); 28 | expect(str.substring).not.toHaveBeenCalled(); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /specs/my_some_spec.js: -------------------------------------------------------------------------------- 1 | describe('mySome', () => { 2 | beforeEach( () => { 3 | a = [1, 2, 3]; 4 | }); 5 | 6 | it("returns true if any number matches the block", () => { 7 | const callback = x => x > 1; 8 | expect(a.mySome(callback)).toBe(true); 9 | }); 10 | 11 | it("returns false if no elementes match the block", () => { 12 | const callback = x => x === 4; 13 | expect(a.mySome(callback)).toBe(false); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /specs/permutations_spec.js: -------------------------------------------------------------------------------- 1 | describe("#permutations", () => { 2 | it("returns all permutations of an array", () => { 3 | const array = [1, 2, 3]; 4 | const allPermutations = [ 5 | [1, 2, 3], [1, 3, 2], [2, 1, 3], 6 | [2, 3, 1], [3, 1, 2], [3, 2, 1] 7 | ]; 8 | 9 | expect(permutations([1, 2, 3])).toEqual(allPermutations); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /specs/pig_latinify_spec.js: -------------------------------------------------------------------------------- 1 | describe("#pigLatinify", () => { 2 | it("translates a word beginning with a vowel", () => { 3 | const s = pigLatinify("apple"); 4 | expect(s).toEqual("appleay"); 5 | }); 6 | 7 | it("translates a word beginning with a consonant", () => { 8 | const s = pigLatinify("banana"); 9 | expect(s).toEqual("ananabay"); 10 | }); 11 | 12 | it("translates a word beginning with two consonants", () => { 13 | const s = pigLatinify("cherry"); 14 | expect(s).toEqual("errychay"); 15 | }); 16 | 17 | it("translates two words", () => { 18 | const s = pigLatinify("eat pie"); 19 | expect(s).toEqual("eatay iepay"); 20 | }); 21 | 22 | it("translates a word beginning with three consonants", () => { 23 | expect(pigLatinify("three")).toEqual("eethray");; 24 | }); 25 | 26 | it("counts 'sch' as a single phoneme", () => { 27 | const s = pigLatinify("school"); 28 | expect(s).toEqual("oolschay"); 29 | }); 30 | 31 | it("counts 'qu' as a single phoneme", () => { 32 | const s = pigLatinify("quiet"); 33 | expect(s).toEqual("ietquay"); 34 | }); 35 | 36 | it("counts 'qu' as a consonant when it's preceded by a consonant", () => { 37 | const s = pigLatinify("square"); 38 | expect(s).toEqual("aresquay"); 39 | }); 40 | 41 | it("translates many words", () => { 42 | const s = pigLatinify("the quick brown fox"); 43 | expect(s).toEqual("ethay ickquay ownbray oxfay"); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /specs/prime_factorization_spec.js: -------------------------------------------------------------------------------- 1 | describe("primeFactorization", () => { 2 | it("handles an input of 2", () => { 3 | expect(primeFactorization(2)).toEqual([2]); 4 | }); 5 | 6 | it("Test case: 12", () => { 7 | expect(primeFactorization(12)).toEqual([2,2,3]); 8 | }); 9 | 10 | it("Test case: 600851475143", () => { 11 | expect(primeFactorization(600851475143)).toEqual([71,839,1471,6857]); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /specs/primes_spec.js: -------------------------------------------------------------------------------- 1 | describe("#primes", () => { 2 | it("returns first five primes in order", () => { 3 | expect(primes(5)).toEqual([2, 3, 5, 7, 11]); 4 | }); 5 | 6 | it("returns an empty array when asked for zero primes", () => { 7 | expect(primes(0)).toEqual([]); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /specs/quicksort_spec.js: -------------------------------------------------------------------------------- 1 | describe("quickSort", () => { 2 | it("Sorts an array of numbers with no duplicates", () => { 3 | const a = [ 2, 1, 3, 5, 0, 8, 4, 7, 6]; 4 | expect(a.quickSort()).toEqual(a.sort()); 5 | }); 6 | 7 | it("Sorts an array of numbers with duplicates", () => { 8 | const a = [3, 1, 2, 3, 9, 17, 10, 432, 10]; 9 | const sorted = [1, 2, 3, 3, 9, 10, 10, 17, 432]; 10 | expect(a.quickSort()).toEqual(sorted); 11 | }); 12 | 13 | it("Sorts according to the block passed in", () => { 14 | const a = [ 2, 1, 3, 5, 0, 8, 4, 7, 6]; 15 | const callback = (x, y) => { 16 | if (y < x) return - 1; 17 | return 1; 18 | }; 19 | 20 | expect(a.quickSort(callback)).toEqual(a.sort(callback)); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /specs/real_words_in_string_spec.js: -------------------------------------------------------------------------------- 1 | describe("realWordsInString", () => { 2 | it("finds a simple word", () => { 3 | const words = "asdfcatqwer".realWordsInString(["cat", "car"]); 4 | expect(words).toEqual(["cat"]); 5 | }); 6 | 7 | it("doesn't find words not in the dictionary", () => { 8 | const words = "batcabtarbrat".realWordsInString(["cat", "car"]); 9 | expect(words).toEqual([]); 10 | }); 11 | 12 | it("finds words within words", () => { 13 | const dictionary = ["bears", "ear", "a", "army"]; 14 | const words = "erbearsweatmyajs".realWordsInString(dictionary); 15 | expect(words).toEqual(["bears", "ear", "a"]); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /specs/rec_sum_spec.js: -------------------------------------------------------------------------------- 1 | describe("#recSum", () => { 2 | it("returns the sums of all elements in an array", () => { 3 | arr = [1,2,3,4]; 4 | expect(recSum(arr)).toEqual(10); 5 | }); 6 | 7 | it("returns 0 if the array is empty", () => { 8 | expect(recSum([])).toEqual(0); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /specs/string_include_key_spec.js: -------------------------------------------------------------------------------- 1 | describe("stringIncludeKey", () => { 2 | it("returns true for the same string", () => { 3 | expect(stringIncludeKey("adblfci", "abc")).toEqual(true); 4 | }); 5 | 6 | it("handles keys with duplicate characters: case 1", () => { 7 | expect(stringIncludeKey("adbblfci", "abbc")).toEqual(true); 8 | }); 9 | 10 | it("handles keys with duplicate characters: case 2", () => { 11 | expect(stringIncludeKey("adbclfci", "abbc")).toEqual(false); 12 | }); 13 | 14 | it("returns false if the key characters are in the wrong order", () => { 15 | expect(stringIncludeKey("dblfcia", "abc")).toEqual(false); 16 | }); 17 | 18 | it("returns false if the string doesn't contain the key", () => { 19 | expect(stringIncludeKey("db", "abc")).toEqual(false); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /specs/subsets_spec.js: -------------------------------------------------------------------------------- 1 | describe('subsets', () => { 2 | it("Correctly returns all subsets of an array", () => { 3 | const subs = [ 4 | [], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3] 5 | ]; 6 | 7 | expect(subsets([1, 2, 3])).toEqual(subs); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /specs/support/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "spec", 3 | "spec_files": [ 4 | "**/*[sS]pec.js" 5 | ], 6 | "helpers": [ 7 | "helpers/**/*.js" 8 | ], 9 | "stopSpecOnExpectationFailure": false, 10 | "random": false 11 | } 12 | -------------------------------------------------------------------------------- /specs/symmetric_substrings_spec.js: -------------------------------------------------------------------------------- 1 | describe("#symmetricSubstrings", () => { 2 | it("handles a simple example", () => { 3 | expect("aba".symmetricSubstrings()).toEqual(["aba"]); 4 | }); 5 | 6 | it("handles two substrings", () => { 7 | expect("aba1cdc".symmetricSubstrings()).toEqual(["aba", "cdc"]); 8 | }); 9 | 10 | it("handles nested substrings", () => { 11 | expect("xabax".symmetricSubstrings()).toEqual(["aba", "xabax"]); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /specs/titleize_spec.js: -------------------------------------------------------------------------------- 1 | describe("titleize", () => { 2 | it("capitalizes a word", () => { 3 | expect(titleize("jaws")).toEqual("Jaws"); 4 | }); 5 | 6 | it("capitalizes every word (aka title case)", () => { 7 | expect(titleize("david copperfield")).toEqual("David Copperfield"); 8 | }); 9 | 10 | it("doesn't capitalize 'little words' in a title", () => { 11 | expect(titleize("war and peace")).toEqual("War and Peace"); 12 | }); 13 | 14 | it("does capitalize 'little words' at the start of a title", () => { 15 | expect( 16 | titleize("the bridge over the river kwai") 17 | ).toEqual("The Bridge over the River Kwai"); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /specs/transpose_spec.js: -------------------------------------------------------------------------------- 1 | describe("#transpose", () => { 2 | //before each necessary 3 | const arr = [ 4 | [1, 2, 3], 5 | [4, 5, 6], 6 | [7, 8, 9] 7 | ]; 8 | const small_arr = [ 9 | [1, 2], 10 | [3, 4] 11 | ]; 12 | const rect_arr = [ 13 | [1, 2, 3], 14 | [4, 5, 6] 15 | ]; 16 | const tall_rect_arr = [ 17 | [1, 2], 18 | [3, 4], 19 | [5, 6] 20 | ]; 21 | 22 | it("should transpose a matrix", () => { 23 | expect(transpose(arr)).toEqual([ 24 | [1, 4, 7], 25 | [2, 5, 8], 26 | [3, 6, 9] 27 | ]); 28 | }); 29 | 30 | it("should transpose a matrix of a different size", () => { 31 | expect(transpose(small_arr)).toEqual([ 32 | [1, 3], 33 | [2, 4] 34 | ]); 35 | }); 36 | 37 | it("should transpose a rectangular matrix", () => { 38 | expect(transpose(rect_arr)).toEqual([ 39 | [1, 4], 40 | [2, 5], 41 | [3, 6] 42 | ]); 43 | }); 44 | 45 | it("should transpose a different rectangular matrix", () => { 46 | expect(transpose(tall_rect_arr)).toEqual([ 47 | [1, 3, 5], 48 | [2, 4, 6] 49 | ]); 50 | }); 51 | 52 | it("should not modify the original", () => { 53 | transpose(small_arr); 54 | expect(small_arr).toEqual([ 55 | [1, 2], 56 | [3, 4] 57 | ]); 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /specs/two_sum_spec.js: -------------------------------------------------------------------------------- 1 | describe("#twoSum", () => { 2 | it("returns positions of pairs of numbers that add to zero", () => { 3 | expect([5, 1, -7, -5].twoSum()).toEqual([[0, 3]]); 4 | }); 5 | 6 | it("finds multiple pairs", () => { 7 | expect([5, -1, -5, 1].twoSum()).toEqual([[0, 2], [1, 3]]); 8 | }); 9 | 10 | it("finds pairs with same element", () => { 11 | expect([5, -5, -5].twoSum()).toEqual([[0, 1], [0, 2]]); 12 | }); 13 | 14 | it("returns [] when no pair is found", () => { 15 | expect([5, 5, 3, 1].twoSum()).toEqual([]); 16 | }); 17 | 18 | it("won't find spurious zero pairs", () => { 19 | expect([0, 1, 2, 3].twoSum()).toEqual([]); 20 | }); 21 | 22 | it("will find real zero pairs", () => { 23 | expect([0, 1, 2, 0].twoSum()).toEqual([[0, 3]]); 24 | }); 25 | }); 26 | --------------------------------------------------------------------------------