trackler 2.0.7.0 → 2.0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/common/exercises/counter/metadata.yml +0 -4
- data/common/exercises/error-handling/metadata.yml +0 -4
- data/common/exercises/etl/canonical-data.json +1 -1
- data/common/exercises/hello-world/canonical-data.json +9 -21
- data/common/exercises/hello-world/description.md +7 -42
- data/common/exercises/hello-world/metadata.yml +1 -1
- data/common/exercises/lens-person/metadata.yml +0 -3
- data/common/exercises/luhn/canonical-data.json +17 -17
- data/common/exercises/nucleotide-codons/metadata.yml +0 -2
- data/common/exercises/react/metadata.yml +0 -2
- data/common/exercises/rectangles/metadata.yml +0 -3
- data/common/exercises/variable-length-quantity/metadata.yml +0 -2
- data/fixtures/tracks/snowflake/config.json +17 -0
- data/fixtures/tracks/snowflake/exercises/snowflake-only/description.md +1 -0
- data/fixtures/tracks/snowflake/exercises/snowflake-only/metadata.yml +4 -0
- data/lib/trackler/description.rb +27 -0
- data/lib/trackler/guaranteed_file.rb +77 -0
- data/lib/trackler/implementations.rb +5 -5
- data/lib/trackler/metadata.rb +27 -0
- data/lib/trackler/null_track.rb +22 -0
- data/lib/trackler/problem.rb +32 -34
- data/lib/trackler/track.rb +1 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/csharp/exercises/hello-world/Example.cs +2 -5
- data/tracks/csharp/exercises/hello-world/HelloWorldTest.cs +2 -16
- data/tracks/elixir/config.json +7 -0
- data/tracks/elixir/exercises/series/example.exs +13 -0
- data/tracks/elixir/exercises/series/series.exs +11 -0
- data/tracks/elixir/exercises/series/series_test.exs +53 -0
- data/tracks/erlang/README.md +3 -3
- data/tracks/erlang/config.json +15 -11
- data/tracks/erlang/exercises/{binary → all-your-base}/include/exercism.hrl +0 -0
- data/tracks/erlang/exercises/{binary → all-your-base}/rebar.config +0 -0
- data/tracks/erlang/exercises/{trinary/src/trinary.app.src → all-your-base/src/all_your_base.app.src} +2 -2
- data/tracks/erlang/exercises/all-your-base/src/example.erl +33 -0
- data/tracks/erlang/exercises/all-your-base/test/all_your_base_tests.erl +69 -0
- data/tracks/erlang/exercises/hello-world/src/example.erl +4 -4
- data/tracks/erlang/exercises/hello-world/test/hello_world_tests.erl +3 -12
- data/tracks/erlang/exercises/{trinary → rotational-cipher}/include/exercism.hrl +0 -0
- data/tracks/erlang/exercises/{trinary → rotational-cipher}/rebar.config +8 -1
- data/tracks/erlang/exercises/rotational-cipher/src/example.erl +19 -0
- data/tracks/erlang/exercises/{binary/src/binary.app.src → rotational-cipher/src/rotational_cipher.app.src} +2 -2
- data/tracks/erlang/exercises/rotational-cipher/test/rotational_cipher_tests.erl +98 -0
- data/tracks/fsharp/exercises/grep/GrepTest.fs +57 -0
- data/tracks/fsharp/exercises/hello-world/Example.fs +1 -1
- data/tracks/fsharp/exercises/hello-world/HelloWorldTest.fs +2 -12
- data/tracks/go/.travis.yml +7 -15
- data/tracks/go/exercises/hello-world/example.go +4 -8
- data/tracks/go/exercises/hello-world/hello_test.go +20 -16
- data/tracks/go/exercises/hello-world/hello_world.go +12 -2
- data/tracks/groovy/exercises/hello-world/Example.groovy +2 -2
- data/tracks/groovy/exercises/hello-world/HelloWorld.groovy +1 -1
- data/tracks/groovy/exercises/hello-world/HelloWorldSpec.groovy +1 -14
- data/tracks/haskell/config.json +6 -0
- data/tracks/haskell/exercises/hello-world/HINTS.md +6 -0
- data/tracks/haskell/exercises/hello-world/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/hello-world/examples/success-standard/src/HelloWorld.hs +4 -0
- data/tracks/haskell/exercises/hello-world/package.yaml +19 -0
- data/tracks/haskell/exercises/hello-world/src/HelloWorld.hs +4 -0
- data/tracks/haskell/exercises/hello-world/stack.yaml +1 -0
- data/tracks/haskell/exercises/hello-world/test/Tests.hs +13 -0
- data/tracks/idris/config.json +9 -0
- data/tracks/idris/exercises/leap/Leap.ipkg +5 -0
- data/tracks/idris/exercises/leap/Makefile +23 -0
- data/tracks/idris/exercises/leap/src/Leap.idr +5 -0
- data/tracks/idris/exercises/leap/src/Test/Leap.idr +37 -0
- data/tracks/idris/exercises/leap/src/example.idr +8 -0
- data/tracks/{typescript/exercises → java}/.keep +0 -0
- data/tracks/java/config.json +115 -172
- data/tracks/java/exercises/anagram/src/test/java/AnagramTest.java +41 -13
- data/tracks/java/exercises/list-ops/build.gradle +18 -0
- data/tracks/java/exercises/list-ops/src/example/java/ListOps.java +51 -0
- data/tracks/java/exercises/list-ops/src/main/java/.keep +0 -0
- data/tracks/java/exercises/list-ops/src/test/java/ListOpsTest.java +316 -0
- data/tracks/java/exercises/palindrome-products/src/example/java/Palindromes.java +28 -62
- data/tracks/java/exercises/palindrome-products/src/test/java/PalindromesTest.java +26 -83
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/julia/config.json +1 -2
- data/tracks/julia/exercises/hello-world/example.jl +2 -2
- data/tracks/julia/exercises/hello-world/runtests.jl +1 -6
- data/tracks/lua/exercises/TRACK_HINTS.md +8 -0
- data/tracks/lua/exercises/hello-world/example.lua +2 -3
- data/tracks/lua/exercises/hello-world/hello-world.lua +18 -0
- data/tracks/lua/exercises/hello-world/hello-world_spec.lua +6 -12
- data/tracks/ocaml/exercises/phone-number/example.ml +8 -18
- data/tracks/ocaml/exercises/phone-number/phone_number.mli +1 -7
- data/tracks/ocaml/exercises/phone-number/test.ml +24 -23
- data/tracks/ocaml/tools/test-generator/src/special_cases.ml +6 -0
- data/tracks/ocaml/tools/test-generator/templates/phone-number/template.ml +21 -0
- data/tracks/pony/config.json +2 -2
- data/tracks/pony/exercises/hello-world/example.pony +1 -2
- data/tracks/pony/exercises/hello-world/test.pony +0 -1
- data/tracks/rust/config.json +0 -1
- data/tracks/rust/exercises/hello-world/example.rs +2 -5
- data/tracks/rust/exercises/hello-world/tests/hello-world.rs +2 -14
- data/tracks/scala/config.json +11 -2
- data/tracks/scala/docs/LEARNING.md +10 -2
- data/tracks/scala/docs/RESOURCES.md +0 -1
- data/tracks/scala/docs/TESTS.md +10 -6
- data/tracks/scala/exercises/rail-fence-cipher/build.sbt +3 -0
- data/tracks/scala/exercises/rail-fence-cipher/example.scala +46 -0
- data/tracks/scala/exercises/rail-fence-cipher/src/main/scala/RailFenceCipher.scala +0 -0
- data/tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala +42 -0
- data/tracks/scala/testgen/src/main/scala/RailFenceCipherTestGenerator.scala +59 -0
- data/tracks/typescript/.gitignore +7 -0
- data/tracks/typescript/.travis.yml +18 -1
- data/tracks/typescript/Dangerfile +43 -0
- data/tracks/typescript/Makefile +57 -0
- data/tracks/typescript/README.md +38 -5
- data/tracks/typescript/SETUP.md +24 -0
- data/tracks/typescript/common/package.json +37 -0
- data/tracks/typescript/common/tsconfig.json +21 -0
- data/tracks/typescript/common/tslint.json +127 -0
- data/tracks/typescript/common/yarn.lock +2697 -0
- data/tracks/typescript/config.json +82 -2
- data/tracks/typescript/docs/ABOUT.md +1 -0
- data/tracks/typescript/docs/INSTALLATION.md +17 -0
- data/tracks/typescript/docs/LEARNING.md +8 -0
- data/tracks/typescript/docs/RESOURCES.md +7 -0
- data/tracks/typescript/docs/TESTS.md +36 -0
- data/tracks/typescript/exercises/anagram/anagram.example.ts +23 -0
- data/tracks/typescript/exercises/anagram/anagram.test.ts +82 -0
- data/tracks/typescript/exercises/anagram/package.json +37 -0
- data/tracks/typescript/exercises/anagram/tsconfig.json +21 -0
- data/tracks/typescript/exercises/anagram/tslint.json +127 -0
- data/tracks/typescript/exercises/anagram/yarn.lock +2697 -0
- data/tracks/typescript/exercises/beer-song/beer-song.example.ts +36 -0
- data/tracks/typescript/exercises/beer-song/beer-song.test.ts +360 -0
- data/tracks/typescript/exercises/beer-song/package.json +37 -0
- data/tracks/typescript/exercises/beer-song/tsconfig.json +21 -0
- data/tracks/typescript/exercises/beer-song/tslint.json +127 -0
- data/tracks/typescript/exercises/beer-song/yarn.lock +2697 -0
- data/tracks/typescript/exercises/bob/bob.example.ts +24 -0
- data/tracks/typescript/exercises/bob/bob.test.ts +92 -0
- data/tracks/typescript/exercises/bob/package.json +37 -0
- data/tracks/typescript/exercises/bob/tsconfig.json +21 -0
- data/tracks/typescript/exercises/bob/tslint.json +127 -0
- data/tracks/typescript/exercises/bob/yarn.lock +2697 -0
- data/tracks/typescript/exercises/gigasecond/gigasecond.example.ts +11 -0
- data/tracks/typescript/exercises/gigasecond/gigasecond.test.ts +29 -0
- data/tracks/typescript/exercises/gigasecond/package.json +37 -0
- data/tracks/typescript/exercises/gigasecond/tsconfig.json +21 -0
- data/tracks/typescript/exercises/gigasecond/tslint.json +127 -0
- data/tracks/typescript/exercises/gigasecond/yarn.lock +2697 -0
- data/tracks/typescript/exercises/hamming/hamming.example.ts +19 -0
- data/tracks/typescript/exercises/hamming/hamming.test.ts +39 -0
- data/tracks/typescript/exercises/hamming/package.json +37 -0
- data/tracks/typescript/exercises/hamming/tsconfig.json +21 -0
- data/tracks/typescript/exercises/hamming/tslint.json +127 -0
- data/tracks/typescript/exercises/hamming/yarn.lock +2697 -0
- data/tracks/typescript/exercises/hello-world/hello-world.example.ts +8 -0
- data/tracks/typescript/exercises/hello-world/hello-world.test.ts +17 -0
- data/tracks/typescript/exercises/hello-world/package.json +37 -0
- data/tracks/typescript/exercises/hello-world/tsconfig.json +21 -0
- data/tracks/typescript/exercises/hello-world/tslint.json +127 -0
- data/tracks/typescript/exercises/hello-world/yarn.lock +2697 -0
- data/tracks/typescript/exercises/leap/leap.example.ts +6 -0
- data/tracks/typescript/exercises/leap/leap.test.ts +39 -0
- data/tracks/typescript/exercises/leap/package.json +37 -0
- data/tracks/typescript/exercises/leap/tsconfig.json +21 -0
- data/tracks/typescript/exercises/leap/tslint.json +127 -0
- data/tracks/typescript/exercises/leap/yarn.lock +2697 -0
- data/tracks/typescript/exercises/pangram/package.json +37 -0
- data/tracks/typescript/exercises/pangram/pangram.example.ts +32 -0
- data/tracks/typescript/exercises/pangram/pangram.test.ts +50 -0
- data/tracks/typescript/exercises/pangram/tsconfig.json +21 -0
- data/tracks/typescript/exercises/pangram/tslint.json +127 -0
- data/tracks/typescript/exercises/pangram/yarn.lock +2697 -0
- data/tracks/typescript/exercises/phone-number/package.json +37 -0
- data/tracks/typescript/exercises/phone-number/phone-number.example.ts +21 -0
- data/tracks/typescript/exercises/phone-number/phone-number.test.ts +55 -0
- data/tracks/typescript/exercises/phone-number/tsconfig.json +21 -0
- data/tracks/typescript/exercises/phone-number/tslint.json +127 -0
- data/tracks/typescript/exercises/phone-number/yarn.lock +2697 -0
- data/tracks/typescript/exercises/rna-transcription/package.json +37 -0
- data/tracks/typescript/exercises/rna-transcription/rna-transcription.example.ts +13 -0
- data/tracks/typescript/exercises/rna-transcription/rna-transcription.test.ts +45 -0
- data/tracks/typescript/exercises/rna-transcription/tsconfig.json +21 -0
- data/tracks/typescript/exercises/rna-transcription/tslint.json +127 -0
- data/tracks/typescript/exercises/rna-transcription/yarn.lock +2697 -0
- data/tracks/typescript/exercises/say/package.json +37 -0
- data/tracks/typescript/exercises/say/say.example.ts +95 -0
- data/tracks/typescript/exercises/say/say.test.ts +78 -0
- data/tracks/typescript/exercises/say/tsconfig.json +21 -0
- data/tracks/typescript/exercises/say/tslint.json +127 -0
- data/tracks/typescript/exercises/say/yarn.lock +2697 -0
- data/tracks/typescript/exercises/word-count/package.json +37 -0
- data/tracks/typescript/exercises/word-count/tsconfig.json +21 -0
- data/tracks/typescript/exercises/word-count/tslint.json +127 -0
- data/tracks/typescript/exercises/word-count/word-count.example.ts +16 -0
- data/tracks/typescript/exercises/word-count/word-count.test.ts +65 -0
- data/tracks/typescript/exercises/word-count/yarn.lock +2697 -0
- data/tracks/typescript/exercises/wordy/package.json +37 -0
- data/tracks/typescript/exercises/wordy/tsconfig.json +21 -0
- data/tracks/typescript/exercises/wordy/tslint.json +127 -0
- data/tracks/typescript/exercises/wordy/wordy.example.ts +40 -0
- data/tracks/typescript/exercises/wordy/wordy.test.ts +89 -0
- data/tracks/typescript/exercises/wordy/yarn.lock +2697 -0
- data/tracks/typescript/img/icon.png +0 -0
- data/tracks/typescript/img/icon.svg +10 -0
- metadata +134 -15
- data/tracks/erlang/exercises/binary/src/example.erl +0 -20
- data/tracks/erlang/exercises/binary/test/binary_string_tests.erl +0 -26
- data/tracks/erlang/exercises/trinary/Makefile +0 -10
- data/tracks/erlang/exercises/trinary/src/example.erl +0 -66
- data/tracks/erlang/exercises/trinary/test/trinary_tests.erl +0 -36
- data/tracks/fsharp/exercises/hello-world/HINTS.md +0 -5
@@ -3,8 +3,86 @@
|
|
3
3
|
"language": "TypeScript",
|
4
4
|
"repository": "https://github.com/exercism/xtypescript",
|
5
5
|
"active": false,
|
6
|
-
"test_pattern": "
|
6
|
+
"test_pattern": ".*[.]test[.]ts$",
|
7
7
|
"exercises": [
|
8
|
+
{
|
9
|
+
"slug": "hello-world",
|
10
|
+
"difficulty": 1,
|
11
|
+
"topics": [
|
12
|
+
]
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"slug": "leap",
|
16
|
+
"difficulty": 1,
|
17
|
+
"topics": [
|
18
|
+
]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"slug": "hamming",
|
22
|
+
"difficulty": 1,
|
23
|
+
"topics": [
|
24
|
+
]
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"slug": "rna-transcription",
|
28
|
+
"difficulty": 1,
|
29
|
+
"topics": [
|
30
|
+
]
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"slug": "bob",
|
34
|
+
"difficulty": 1,
|
35
|
+
"topics": [
|
36
|
+
]
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"slug": "gigasecond",
|
40
|
+
"difficulty": 1,
|
41
|
+
"topics": [
|
42
|
+
]
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"slug": "word-count",
|
46
|
+
"difficulty": 1,
|
47
|
+
"topics": [
|
48
|
+
]
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"slug": "pangram",
|
52
|
+
"difficulty": 1,
|
53
|
+
"topics": [
|
54
|
+
]
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"slug": "beer-song",
|
58
|
+
"difficulty": 1,
|
59
|
+
"topics": [
|
60
|
+
]
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"slug": "phone-number",
|
64
|
+
"difficulty": 1,
|
65
|
+
"topics": [
|
66
|
+
]
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"slug": "anagram",
|
70
|
+
"difficulty": 1,
|
71
|
+
"topics": [
|
72
|
+
]
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"slug": "wordy",
|
76
|
+
"difficulty": 1,
|
77
|
+
"topics": [
|
78
|
+
]
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"slug": "say",
|
82
|
+
"difficulty": 1,
|
83
|
+
"topics": [
|
84
|
+
]
|
85
|
+
}
|
8
86
|
|
9
87
|
],
|
10
88
|
"deprecated": [
|
@@ -13,8 +91,10 @@
|
|
13
91
|
"ignored": [
|
14
92
|
"bin",
|
15
93
|
"img",
|
16
|
-
"docs"
|
94
|
+
"docs",
|
95
|
+
"common"
|
17
96
|
],
|
97
|
+
|
18
98
|
"foregone": [
|
19
99
|
|
20
100
|
]
|
@@ -0,0 +1 @@
|
|
1
|
+
[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescriptlang).
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Install [Yarn](https://yarnpkg.com/lang/en/docs/install):
|
2
|
+
|
3
|
+
* **OS X users**: can use `brew install yarn`
|
4
|
+
* **Windows users**: can
|
5
|
+
[download an Installer](https://yarnpkg.com/latest.msi)
|
6
|
+
* **Linux users**: can install it
|
7
|
+
[via package manager](https://yarnpkg.com/lang/en/docs/install/#linux-tab)
|
8
|
+
|
9
|
+
Each assignment needs some tools to run the tests:
|
10
|
+
|
11
|
+
They can be installed running this command within each assignment directory:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
$ yarn install
|
15
|
+
```
|
16
|
+
|
17
|
+
You must run install before you are able to run the tests.
|
@@ -0,0 +1,8 @@
|
|
1
|
+
If you want to learn Typescript, check out the following resources.
|
2
|
+
|
3
|
+
* [TS Tutorial] https://www.typescriptlang.org/docs/tutorial.html
|
4
|
+
|
5
|
+
TypeScript is a superset of JS.
|
6
|
+
* [Exploring ES6](https://leanpub.com/exploring-es6) book, by Axel Rauschmayer
|
7
|
+
* [ES6 Katas](http://es6katas.org) website
|
8
|
+
* [Babel compiler](https://github.com/babel/babel)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
## Recommended References
|
2
|
+
|
3
|
+
* [TypeScript QuickStart](https://www.typescriptlang.org/docs/tutorial.html)
|
4
|
+
|
5
|
+
* [ECMAScript 2015 Language Specification](http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf) (pdf)
|
6
|
+
* [Mozilla JavaScript Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference)
|
7
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Execute the tests with:
|
2
|
+
|
3
|
+
```bash
|
4
|
+
$ yarn test
|
5
|
+
```
|
6
|
+
|
7
|
+
Be sure your code follows best practices and coding styles, as other users do, with
|
8
|
+
TSLint, a tool to perform static analysis to your code. Sometimes, tools like this
|
9
|
+
save you some time detecting typos or silly mistakes in your code:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
$ yarn lint
|
13
|
+
```
|
14
|
+
|
15
|
+
Or do both at the same time:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ yarn test && yarn lint
|
19
|
+
|
20
|
+
```
|
21
|
+
|
22
|
+
## Making Your First Module
|
23
|
+
|
24
|
+
Usually, tests on this track will load your implementation importing it as a module: `import Bob from './bob';`. To make it work, you just
|
25
|
+
needs to export your implementation from the file the tests are looking for
|
26
|
+
your module, `bob.ts`:
|
27
|
+
|
28
|
+
```javascript
|
29
|
+
export default class Bob {
|
30
|
+
hey(message: string) {
|
31
|
+
//
|
32
|
+
// Your solution to the exercise goes here
|
33
|
+
//
|
34
|
+
}
|
35
|
+
}
|
36
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
function sort(input: string): string {
|
2
|
+
return input.toString().toLowerCase().split("").sort().join("")
|
3
|
+
}
|
4
|
+
|
5
|
+
class Anagram {
|
6
|
+
value: string
|
7
|
+
constructor(input: string) {
|
8
|
+
this.value = input
|
9
|
+
}
|
10
|
+
|
11
|
+
matches(...input: string[]): string[] {
|
12
|
+
const result: string[] = []
|
13
|
+
for (const each of input) {
|
14
|
+
if ( sort(each) === sort(this.value) ) {
|
15
|
+
if (each.toLowerCase() === this.value.toLowerCase()) {continue}
|
16
|
+
result.push(each)
|
17
|
+
}
|
18
|
+
}
|
19
|
+
return result
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
export default Anagram
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import Anagram from './anagram'
|
2
|
+
|
3
|
+
describe('Anagram', () => {
|
4
|
+
|
5
|
+
it("no matches", () => {
|
6
|
+
const subject = new Anagram("diaper")
|
7
|
+
const matches = subject.matches(...[ "hello", "world", "zombies", "pants"])
|
8
|
+
|
9
|
+
expect(matches).toEqual([])
|
10
|
+
})
|
11
|
+
|
12
|
+
it("detects simple anagram", () => {
|
13
|
+
const subject = new Anagram("ant")
|
14
|
+
const matches = subject.matches(...['tan', 'stand', 'at'])
|
15
|
+
|
16
|
+
expect(matches).toEqual(['tan'])
|
17
|
+
})
|
18
|
+
|
19
|
+
it("does not detect false positives", () => {
|
20
|
+
const subject = new Anagram("galea")
|
21
|
+
const matches = subject.matches(...["eagle"])
|
22
|
+
|
23
|
+
expect(matches).toEqual([])
|
24
|
+
})
|
25
|
+
|
26
|
+
it("detects multiple anagrams", () => {
|
27
|
+
const subject = new Anagram("master")
|
28
|
+
const matches = subject.matches(...['stream', 'pigeon', 'maters'])
|
29
|
+
|
30
|
+
expect(matches).toEqual(['stream', 'maters'])
|
31
|
+
})
|
32
|
+
|
33
|
+
it("does not detect anagram subsets", () => {
|
34
|
+
const subject = new Anagram("good")
|
35
|
+
const matches = subject.matches(...['dog', 'goody'])
|
36
|
+
|
37
|
+
expect(matches).toEqual([])
|
38
|
+
})
|
39
|
+
|
40
|
+
it("detects anagram", () => {
|
41
|
+
const subject = new Anagram("listen")
|
42
|
+
const matches = subject.matches(...['enlists', 'google', 'inlets', 'banana'])
|
43
|
+
|
44
|
+
expect(matches).toEqual(['inlets'])
|
45
|
+
})
|
46
|
+
|
47
|
+
it("detects multiple anagrams", () => {
|
48
|
+
const subject = new Anagram("allergy")
|
49
|
+
const matches = subject.matches(...['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading'])
|
50
|
+
|
51
|
+
expect(matches).toEqual(['gallery', 'regally', 'largely'])
|
52
|
+
})
|
53
|
+
|
54
|
+
it("detects anagrams case-insensitively", () => {
|
55
|
+
const subject = new Anagram("Orchestra")
|
56
|
+
const matches = subject.matches(...['cashregister', 'Carthorse', 'radishes'])
|
57
|
+
|
58
|
+
expect(matches).toEqual(['Carthorse'])
|
59
|
+
})
|
60
|
+
|
61
|
+
it("does not detect a word as its own anagram", () => {
|
62
|
+
const subject = new Anagram("banana")
|
63
|
+
const matches = subject.matches(...['Banana'])
|
64
|
+
|
65
|
+
expect(matches).toEqual([])
|
66
|
+
})
|
67
|
+
|
68
|
+
it("matches() accepts string arguments", () => {
|
69
|
+
const subject = new Anagram("ant")
|
70
|
+
const matches = subject.matches("stand", "tan", "at")
|
71
|
+
|
72
|
+
expect(matches).toEqual(["tan"])
|
73
|
+
})
|
74
|
+
|
75
|
+
it("matches() accepts single string argument", () => {
|
76
|
+
const subject = new Anagram("ant")
|
77
|
+
const matches = subject.matches("tan")
|
78
|
+
|
79
|
+
expect(matches).toEqual(["tan"])
|
80
|
+
})
|
81
|
+
|
82
|
+
})
|
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"name": "xtypescript",
|
3
|
+
"version": "0",
|
4
|
+
"description": "Exercism exercises in Typescript.",
|
5
|
+
"author": "",
|
6
|
+
"private": true,
|
7
|
+
"repository": {
|
8
|
+
"type": "git",
|
9
|
+
"url": "https://github.com/exercism/xtypescript"
|
10
|
+
},
|
11
|
+
"devDependencies": {
|
12
|
+
},
|
13
|
+
"scripts": {
|
14
|
+
"test": "jest --no-cache",
|
15
|
+
"lint": "tslint '*.ts?(x)'; exit 0"
|
16
|
+
},
|
17
|
+
"dependencies": {
|
18
|
+
"@types/jest": "^18.1.1",
|
19
|
+
"@types/node": "^7.0.5",
|
20
|
+
"jest": "^18.1.0",
|
21
|
+
"ts-jest": "^18.0.3",
|
22
|
+
"tslint": "^4.4.2",
|
23
|
+
"typescript": "^2.1.6"
|
24
|
+
},
|
25
|
+
"jest": {
|
26
|
+
"transform": {
|
27
|
+
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
|
28
|
+
},
|
29
|
+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
30
|
+
"testResultsProcessor": "<rootDir>/node_modules/ts-jest/coverageprocessor.js",
|
31
|
+
"moduleFileExtensions": [
|
32
|
+
"ts",
|
33
|
+
"tsx",
|
34
|
+
"js"
|
35
|
+
]
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"target": "es2017",
|
4
|
+
"module": "commonjs",
|
5
|
+
"alwaysStrict": true,
|
6
|
+
"noUnusedLocals": true,
|
7
|
+
"noUnusedParameters": true,
|
8
|
+
"noImplicitAny": true,
|
9
|
+
"strictNullChecks": true,
|
10
|
+
"preserveConstEnums": true,
|
11
|
+
"noFallthroughCasesInSwitch":true,
|
12
|
+
"noImplicitThis":true,
|
13
|
+
"noImplicitReturns":true,
|
14
|
+
"sourceMap": true,
|
15
|
+
"outDir": "./build"
|
16
|
+
},
|
17
|
+
"compileOnSave": true,
|
18
|
+
"exclude": [
|
19
|
+
"node_modules"
|
20
|
+
]
|
21
|
+
}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
{
|
2
|
+
"jsRules": {
|
3
|
+
"class-name": true,
|
4
|
+
"comment-format": [
|
5
|
+
true,
|
6
|
+
"check-space"
|
7
|
+
],
|
8
|
+
"indent": [
|
9
|
+
true,
|
10
|
+
"spaces"
|
11
|
+
],
|
12
|
+
"no-duplicate-variable": true,
|
13
|
+
"no-eval": true,
|
14
|
+
"no-trailing-whitespace": true,
|
15
|
+
"no-unsafe-finally": true,
|
16
|
+
"one-line": [
|
17
|
+
true,
|
18
|
+
"check-open-brace",
|
19
|
+
"check-whitespace"
|
20
|
+
],
|
21
|
+
"quotemark": [
|
22
|
+
false,
|
23
|
+
"double"
|
24
|
+
],
|
25
|
+
"semicolon": [
|
26
|
+
true,
|
27
|
+
"never"
|
28
|
+
],
|
29
|
+
"triple-equals": [
|
30
|
+
true,
|
31
|
+
"allow-null-check"
|
32
|
+
],
|
33
|
+
"variable-name": [
|
34
|
+
true,
|
35
|
+
"ban-keywords"
|
36
|
+
],
|
37
|
+
"whitespace": [
|
38
|
+
true,
|
39
|
+
"check-branch",
|
40
|
+
"check-decl",
|
41
|
+
"check-operator",
|
42
|
+
"check-separator",
|
43
|
+
"check-type"
|
44
|
+
]
|
45
|
+
},
|
46
|
+
"rules": {
|
47
|
+
"class-name": true,
|
48
|
+
"comment-format": [
|
49
|
+
true,
|
50
|
+
"check-space"
|
51
|
+
],
|
52
|
+
"indent": [
|
53
|
+
true,
|
54
|
+
"spaces"
|
55
|
+
],
|
56
|
+
"no-eval": true,
|
57
|
+
"no-internal-module": true,
|
58
|
+
"no-trailing-whitespace": true,
|
59
|
+
"no-unsafe-finally": true,
|
60
|
+
"no-var-keyword": true,
|
61
|
+
"one-line": [
|
62
|
+
true,
|
63
|
+
"check-open-brace",
|
64
|
+
"check-whitespace"
|
65
|
+
],
|
66
|
+
"semicolon": [
|
67
|
+
true,
|
68
|
+
"never"
|
69
|
+
],
|
70
|
+
"triple-equals": [
|
71
|
+
true,
|
72
|
+
"allow-null-check"
|
73
|
+
],
|
74
|
+
"typedef-whitespace": [
|
75
|
+
true,
|
76
|
+
{
|
77
|
+
"call-signature": "nospace",
|
78
|
+
"index-signature": "nospace",
|
79
|
+
"parameter": "nospace",
|
80
|
+
"property-declaration": "nospace",
|
81
|
+
"variable-declaration": "nospace"
|
82
|
+
}
|
83
|
+
],
|
84
|
+
"variable-name": [
|
85
|
+
true,
|
86
|
+
"ban-keywords"
|
87
|
+
],
|
88
|
+
"whitespace": [
|
89
|
+
true,
|
90
|
+
"check-branch",
|
91
|
+
"check-decl",
|
92
|
+
"check-operator",
|
93
|
+
"check-separator",
|
94
|
+
"check-type"
|
95
|
+
],
|
96
|
+
"no-namespace": true,
|
97
|
+
"prefer-for-of": true,
|
98
|
+
"only-arrow-functions": [true, "allow-declarations"],
|
99
|
+
"no-var-requires": true,
|
100
|
+
"no-any": true,
|
101
|
+
"curly": true,
|
102
|
+
"forin": true,
|
103
|
+
"no-arg": true,
|
104
|
+
"label-position": true,
|
105
|
+
"no-conditional-assignment": true,
|
106
|
+
"no-console": [true, "log", "error"],
|
107
|
+
"no-construct": true,
|
108
|
+
"no-duplicate-variable": true,
|
109
|
+
"no-empty": true,
|
110
|
+
"no-invalid-this": [true, "check-function-in-method"],
|
111
|
+
"no-misused-new": true,
|
112
|
+
"no-null-keyword": true,
|
113
|
+
"no-string-literal": true,
|
114
|
+
"radix": true,
|
115
|
+
"typeof-compare": true,
|
116
|
+
"use-isnan": true,
|
117
|
+
"prefer-const": true,
|
118
|
+
"array-type": [true, "array-simple"],
|
119
|
+
"arrow-parens": true,
|
120
|
+
"new-parens": true,
|
121
|
+
"no-consecutive-blank-lines": [true,1],
|
122
|
+
"no-parameter-properties": true,
|
123
|
+
"no-unnecessary-initializer": true,
|
124
|
+
"object-literal-shorthand": true,
|
125
|
+
"object-literal-key-quotes": [true, "as-needed"]
|
126
|
+
}
|
127
|
+
}
|