Commit fd2be2a
committed
Define has() helper function to check for undefined (close #93)
Previously, Licensee would create a license criteria configuration
object at runtime when options like `--osi` and `--blueoak=` were set.
Unfortunately, the code that did so used constructions like
`option['blueOak'] || undefined`, while logic for checking licenses
based on that configuration used the `hasown` package to check whether
various kinds of license constraints had been set. This set us up for
errors, like the one reported by @jayvdb in #93, where Licensee attempts
to read constraints that haven't been provided, since they exist as own
properties of the configuration object, but are set to `undefined`.
This PR adds a test replicating #93 and redefines the `has()` helper
function as a wrapper around `hasown` that _also_ checks to make sure
the own property value is _not_ `undefined`. This avoids the error, and
should for other invocations with similar flags.1 parent cdf5ad1 commit fd2be2a
File tree
4 files changed
+18
-2
lines changed- tests
- osi-flag-pass
- osi-pass
4 files changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
0 commit comments