Skip to content

isKnown

Whether a raw license string resolves to at least one recognized family — false for an empty string, a purely non-informative claim ("custom", "unknown", "LicenseRef-EULA", …), or a compound expression where every token is non-informative.

Available since v3.1.2

import { isKnown } from '@helpers4/license';
// or, from the all-in-one package (same code, one install):
import { isKnown } from 'helpers4/license';
isKnown(raw: string): boolean
ParameterTypeDescription
rawstringThe raw license string to check

boolean — true if at least one token in raw resolves to a real family

Filter out entries with no real license information

Section titled “Filter out entries with no real license information”

Handy for flagging catalog entries whose license field is not actually usable.

['MIT', 'custom:Acme EULA', 'unknown'].filter(isKnown)
// => ['MIT']

A vendor-specific EULA is not a recognized family

Section titled “A vendor-specific EULA is not a recognized family”

“custom:” names the vendor’s own license text, not a known open-source family.

isKnown('custom:Acme End User License')
// => false

View source on GitHub