Skip to content

Commit

Permalink
Preventing error when currentNode is undefined on next
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwalter committed Jul 24, 2020
1 parent 66877b8 commit 63102de
Show file tree
Hide file tree
Showing 13 changed files with 4,773 additions and 3,646 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)
10 changes: 10 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/happy-teachers-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ianwalter/decision-tree": patch
---

Preventing error when currentNode is undefined on next
17 changes: 17 additions & 0 deletions .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Changeset
on:
pull_request:
types: [labeled]
jobs:
changeset:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Changeset
uses: ianwalter/add-changeset@v1.0.8
env:
DEBUG: true
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: node:12.10-slim
image: ianwalter/pnpm:v1.1.0
timeout-minutes: 3
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v2
- name: Install
run: yarn
run: pnpm i
- name: Lint
run: yarn lint
run: pnpm lint
- name: Test
run: yarn test
run: pnpm t
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
container:
image: ianwalter/pnpm:v1.1.0
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can
# generate changelogs with the correct commits.
fetch-depth: 0
- name: Install
run: pnpm i --dev
- name: Changesets
uses: changesets/action@bfeb9e077e6cf393e4c4ef17e2bbc75b308b4364
with:
publish: pnpx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist = true
34 changes: 17 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Copyright 2019 Ian Walter
Copyright Ian Walter <pub@ianwalter.dev> (https://ianwalter.dev)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

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

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

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

This license is derived from the MIT License, as amended to limit the impact of
This license is derived from the MIT License, as amended to limit the impact of
the unethical use of open source software.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## Installation

```console
yarn add @ianwalter/decision-tree
pnpm add @ianwalter/decision-tree
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DecisionTree {

getNodeFromLeadsTo (currentNode, { leadsTo }) {
const key = typeof leadsTo === 'function' ? leadsTo(this) : leadsTo
return findItemByKey(currentNode.children, key)
return findItemByKey(currentNode && currentNode.children, key)
}

next () {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"@ianwalter/base-error": "^6.1.0"
},
"devDependencies": {
"@changesets/cli": "^2.9.2",
"@ianwalter/bff": "^9.9.1",
"@ianwalter/dist": "^6.0.0",
"@ianwalter/eslint-config": "^5.3.0",
"@ianwalter/release": "^5.0.2",
"@ianwalter/renovate-config": "^1.3.0"
},
"browserslist": "> 2%, not dead",
Expand Down
Loading

0 comments on commit 63102de

Please sign in to comment.