Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc+fix(lexver): returns object, not string #7

Merged
merged 5 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Also compares versions lexicographically.
"arch": "aarch64",
"os": "linux",
"libc": "none",
"vendor": "unknown"
"vendor": "unknown",
"unknownTerms": ["infra"]
}
```

Expand Down
1 change: 1 addition & 0 deletions host-targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ HostTargets._MATCHERS = {

/**
* @param {Object.<"os"|"arch"|"libc", String>} target
* @param {Array<String>} terms
*/
HostTargets.termsToTarget = function (target, terms) {
let bogoTerms = [];
Expand Down
2 changes: 1 addition & 1 deletion lexver.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Lexver.parsePrefix = function (version) {
* Ex: use '0001.0003' to find previous, stable, default, beta, and next
* @param {Array<String>} versions - sorted lexical versions
* @param {String} prefix - the string to match
* @returns {String}
* @returns {Object.<String, String>}
*/
Lexver.matchSorted = function (versions, prefix) {
let matches = [];
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-classifier",
"version": "0.9.3",
"version": "0.9.4",
"description": "Determine Host Target Triplet (Arch, Libc, OS, Vendor) from a filenames / download URL and uname / User-Agent strings.",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions triplet.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,14 @@ var Triplet = ('object' === typeof module && exports) || {};
vendor: build.vendor || '',
libc: build.libc || '',
//ext: build.ext || '',
unknownTerms: [],
});

for (let term of terms) {
let knownMatch = Triplet.TERMS_PRIMARY_MAP[term];
if (!knownMatch) {
let msg = `${proj.name}: unrecognized term '${term}' in '${terms}'`;
let err = new Error(msg);
throw err;
target.unknownTerms.push(term);
continue;
}

//console.log('dbg-known:', term, knownMatch);
Expand Down
1 change: 1 addition & 0 deletions types.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ module.exports._types = true;
* @prop {ArchString} arch
* @prop {LibcString} libc
* @prop {VendorString} [vendor]
* @prop {Array<String>} [unknownTerms]
* @prop {Boolean} [android] - for intermediary representation
*/