Skip to content

Commit

Permalink
Merge pull request #474 from Blu-J/fix--tuple-wrong
Browse files Browse the repository at this point in the history
Fix  tuple wrong
  • Loading branch information
Blu-J authored Sep 21, 2021
2 parents d521ed3 + 19b97f8 commit 0efd9d0
Show file tree
Hide file tree
Showing 25 changed files with 1,842 additions and 3,560 deletions.
91 changes: 0 additions & 91 deletions .circleci/config.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Testing

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 13.x, 14.x, 15.x]

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Run tests
run: npm run test -- --coverage

- name: Run Prettier Check
run: npm run pretty-check

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ console.log(parserAsTypescriptString(matches.string)); // string

Moving several simple parsers into their own description and parsers. Useful for things like typescript that have primitives like strings, numbers, and booleans.

Changed the tuples to use the style of variadic instead of arrays, needed for typescript inference.

## [4.2.0] - 2021-04-03

Adding in better matching capabilities.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fetch("fishes.com/gold-fishes/12")
.then(
matches.shape({
type: t.literal("gold-fish"),
position: t.tuple([t.number, t.number]),
position: t.tuple(t.number, t.number),
age: t.natural,
name: t.string,
}).unsafeCast
Expand All @@ -53,12 +53,12 @@ And here we can use the type checking and what do in that case. With destructuri

```typescript
import matches from "matches";
const matchNone = matches.tuple([matches.literal("none")]);
const matchSome = matches.tuple([matches.literal("some"), matches.any]);
const matchNone = matches.tuple(matches.literal("none"));
const matchSome = matches.tuple(matches.literal("some"), matches.any);
type option = ReturnType<typeof matchNone.unsafeCast> | typeof matchSome._TYPE;
const matchInteger = matches.every(
matchSome,
matches.tuple[(matches.any, matches.number)]
matches.tuple(matches.any, matches.number)
);
const testValue = ["some", 3];
const currentValue = matches(testValue)
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
"author": "Justin Miller",
"license": "MIT",
"devDependencies": {
"@types/jest": "^26.0.24",
"@types/jest": "^27.0.1",
"fast-check": "^2.17.0",
"jest": "^26.6.3",
"jest-junit": "^12.2.0",
"kind-of": "^6.0.3",
"prettier": "^2.3.2",
"ts-jest": "^26.5.6",
"jest": "27.2.0",
"prettier": "^2.4.1",
"ts-jest": "^27.0.5",
"typescript": "^4.4.0"
},
"jest": {
Expand Down
Loading

0 comments on commit 0efd9d0

Please sign in to comment.