Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information