Skip to content

Commit 63102de

Browse files
author
Ian Walter
committed
Preventing error when currentNode is undefined on next
1 parent 66877b8 commit 63102de

File tree

13 files changed

+4773
-3646
lines changed

13 files changed

+4773
-3646
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)

.changeset/config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"linked": [],
6+
"access": "restricted",
7+
"baseBranch": "master",
8+
"updateInternalDependencies": "patch",
9+
"ignore": []
10+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ianwalter/decision-tree": patch
3+
---
4+
5+
Preventing error when currentNode is undefined on next

.github/workflows/changeset.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Changeset
2+
on:
3+
pull_request:
4+
types: [labeled]
5+
jobs:
6+
changeset:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 5
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- name: Changeset
15+
uses: ianwalter/[email protected]
16+
env:
17+
DEBUG: true

.github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
container:
11-
image: node:12.10-slim
11+
image: ianwalter/pnpm:v1.1.0
12+
timeout-minutes: 3
1213
steps:
1314
- name: Checkout
14-
uses: actions/checkout@master
15+
uses: actions/checkout@v2
1516
- name: Install
16-
run: yarn
17+
run: pnpm i
1718
- name: Lint
18-
run: yarn lint
19+
run: pnpm lint
1920
- name: Test
20-
run: yarn test
21+
run: pnpm t

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
container:
10+
image: ianwalter/pnpm:v1.1.0
11+
timeout-minutes: 10
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
# This makes Actions fetch all Git history so that Changesets can
17+
# generate changelogs with the correct commits.
18+
fetch-depth: 0
19+
- name: Install
20+
run: pnpm i --dev
21+
- name: Changesets
22+
uses: changesets/action@bfeb9e077e6cf393e4c4ef17e2bbc75b308b4364
23+
with:
24+
publish: pnpx changeset publish
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shamefully-hoist = true

LICENSE

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
Copyright 2019 Ian Walter
1+
Copyright Ian Walter <[email protected]> (https://ianwalter.dev)
22

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,
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,
88
subject to the following conditions:
99

10-
* The above copyright notice and this permission notice shall be included in all
10+
* The above copyright notice and this permission notice shall be included in all
1111
copies or substantial portions of the Software.
1212

13-
* The software may not be used by individuals, corporations, governments, or
14-
other groups for systems or activities that actively and knowingly endanger,
15-
harm, or otherwise threaten the physical, mental, economic, or general
13+
* The software may not be used by individuals, corporations, governments, or
14+
other groups for systems or activities that actively and knowingly endanger,
15+
harm, or otherwise threaten the physical, mental, economic, or general
1616
well-being of individuals or groups in violation of the United Nations
17-
Universal Declaration of Human Rights
17+
Universal Declaration of Human Rights
1818
(https://www.un.org/en/universal-declaration-human-rights/).
1919

20-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2525
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2626

27-
This license is derived from the MIT License, as amended to limit the impact of
27+
This license is derived from the MIT License, as amended to limit the impact of
2828
the unethical use of open source software.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
## Installation
1212

1313
```console
14-
yarn add @ianwalter/decision-tree
14+
pnpm add @ianwalter/decision-tree
1515
```
1616

1717
## Usage

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DecisionTree {
4545

4646
getNodeFromLeadsTo (currentNode, { leadsTo }) {
4747
const key = typeof leadsTo === 'function' ? leadsTo(this) : leadsTo
48-
return findItemByKey(currentNode.children, key)
48+
return findItemByKey(currentNode && currentNode.children, key)
4949
}
5050

5151
next () {

0 commit comments

Comments
 (0)