Skip to content

Commit

Permalink
Use Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
paldepind committed Dec 11, 2017
1 parent ca59385 commit 62a320d
Show file tree
Hide file tree
Showing 26 changed files with 979 additions and 552 deletions.
13 changes: 4 additions & 9 deletions .vscode/launch.json
Expand Up @@ -16,9 +16,7 @@
"--colors",
"${workspaceRoot}/test/**/*.ts"
],
"outFiles": [
"${workspaceRoot}/dist"
],
"outFiles": ["${workspaceRoot}/dist"],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"runtimeExecutable": null,
Expand All @@ -27,10 +25,7 @@
"env": {
"NODE_ENV": "testing"
},
"skipFiles": [
"node_modules/**/*.js",
"<node_internals>/**/*.js"
]
},
"skipFiles": ["node_modules/**/*.js", "<node_internals>/**/*.js"]
}
]
}
}
39 changes: 25 additions & 14 deletions README.md
Expand Up @@ -271,8 +271,7 @@ accumulating and where we are now.

To get rid of the extra layer of nesting we often use `sample`. The
`sample` function returns a `Now`-computation that asks for the
current value of a behavior. It has the type `(b: Behavior<A>) =>
Now<A>`. Using `sample` with `scan` looks like this.
current value of a behavior. It has the type `(b: Behavior<A>) => Now<A>`. Using `sample` with `scan` looks like this.

```js
const count = sample(scan((acc, inc) => acc + inc, 0, incrementStream));
Expand Down Expand Up @@ -426,7 +425,7 @@ Returns a stream with all the occurrences from `s` for which
```js
const stream = testStreamFromArray([1, 3, 2, 4, 1]);
const filtered = stream.filter((n) => n > 2);
filtered.semantic() //=> [{ time: 1, value: 3 }, { time: 3, value: 4 }]
filtered.semantic(); //=> [{ time: 1, value: 3 }, { time: 3, value: 4 }]
```

#### `split<A>(predicate: (a: A) => boolean, stream: Stream<A>): [Stream<A>, Stream<A>]`
Expand All @@ -438,7 +437,7 @@ occurrences for which `predicate` returns `false`.
```js
const whereTrue = stream.filter(predicate);
const whereFalse = stream.filter((v) => !predicate(v));
// is equivalent to
// is equivalent to
const [whereTrue, whereFalse] = split(predicate, stream);
```

Expand Down Expand Up @@ -466,11 +465,17 @@ value in the occurrence is then replaced with the sampled value.

```js
const stream = testStreamFromObject({
1: 0, 4: 0, 8: 0, 12: 0
1: 0,
4: 0,
8: 0,
12: 0
});
const shot = snapshot(time, stream);
const result = testStreamFromObject({
1: 1, 4: 4, 8: 8, 12: 12
1: 1,
4: 4,
8: 8,
12: 12
});
// short == result
```
Expand Down Expand Up @@ -503,14 +508,13 @@ the occurrence from `a` comes first.
const s1 = testStreamFromObject({ 0: "#1", 2: "#3" });
const s2 = testStreamFromObject({ 1: "#2", 2: "#4", 3: "#5" });
const combined = combine(s1, s2);
assert.deepEqual(
combined.semantic(),
[
{ time: 0, value: "#1" }, { time: 1, value: "#2" },
{ time: 2, value: "#3" }, { time: 2, value: "#4" },
{ time: 3, value: "#5" }
]
);
assert.deepEqual(combined.semantic(), [
{ time: 0, value: "#1" },
{ time: 1, value: "#2" },
{ time: 2, value: "#3" },
{ time: 2, value: "#4" },
{ time: 3, value: "#5" }
]);
```

#### `isStream(obj: any): boolean`
Expand Down Expand Up @@ -644,17 +648,21 @@ code.
Contributions are very welcome. Development happens as follows:

Install dependencies.

```
npm install
```

Run tests.

```
npm test
```

Running the tests will generate an HTML coverage report in `./coverage/`.

Continuously run the tests with

```
npm run test-watch
```
Expand All @@ -671,16 +679,19 @@ npm run build
```

Run all benchmarks with:

```
npm run bench
```

Run a single benchmark with:

```
node benchmark/<name-of-benchmark>
```

For example

```
node benchmark/scan.suite
```

0 comments on commit 62a320d

Please sign in to comment.