Open-source licenses filter algorithm library written in TypeScript
- Design document: https://kaiyuanshe.feishu.cn/wiki/wikcnRn5pkE3BSvqFUMkJPymaG3
- UI implement: https://kaiyuanshe.cn/tool/license-filter
npm i license-filter
import {
FeatureAttitude,
InfectionRange,
filterLicenses
} from 'license-filter';
const list = filterLicenses({
popularity: FeatureAttitude.Negative,
reuseCondition: FeatureAttitude.Positive,
infectionIntensity: FeatureAttitude.Positive,
infectionRange: InfectionRange.Module,
jurisdiction: FeatureAttitude.Undefined,
patentStatement: FeatureAttitude.Positive,
patentRetaliation: FeatureAttitude.Positive,
enhancedAttribution: FeatureAttitude.Positive,
privacyLoophole: FeatureAttitude.Negative,
marketingEndorsement: FeatureAttitude.Negative
});
console.log(list); // filtered licenses
- Popularity
- Reuse Condition
- Infection Intensity
- Infection Range
- Jurisdiction
- Patent Statement
- Patent Retaliation
- Enhanced Attribution
- Privacy Loophole
- Marketing Endorsement
-
Mark the weight of various Open-source licenses according to the above Evaluation dimensions:
- Positive
+1
: clearly supports the feature of this dimension - Undefined
0
: no explicit mention of the dimension's feature - Negative
-1
: clearly oppose the characteristics of this dimension
- Positive
-
Input the user's Attitude towards the above dimensional features:
- Positive
+1
: definitely need the feature of this dimension - Undefined
0
: insensitive to the feature of this dimension - Negative
-1
: explicitly reject the feature of this dimension
- Positive
-
Calculate each license by the following formula:
Total weight per license = Dimension weight item x Dimension user attitude value
-
All licenses are ranked in reverse order of the total weight in this screening, which is the result
http://oss-watch.ac.uk/apps/licdiff/
https://kaiyuanshe.cn/license-tool/
- Page: https://github.com/kaiyuanshe/kaiyuanshe.github.io/blob/hexo/themes/Electron/layout/license-tool.ejs
- Logic: https://github.com/kaiyuanshe/kaiyuanshe.github.io/tree/hexo/themes%2FElectron%2Fsource%2FOSLS