https://github.com/pandatix/gojs-cvss
Transpilation of github.com/pandatix/go-cvss to JS
https://github.com/pandatix/gojs-cvss
cvss cvssv4 golang javascript transpilation
Last synced: about 2 months ago
JSON representation
Transpilation of github.com/pandatix/go-cvss to JS
- Host: GitHub
- URL: https://github.com/pandatix/gojs-cvss
- Owner: pandatix
- License: mit
- Archived: true
- Created: 2023-10-28T13:07:33.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-25T13:15:53.000Z (10 months ago)
- Last Synced: 2025-02-18T12:45:45.744Z (8 months ago)
- Topics: cvss, cvssv4, golang, javascript, transpilation
- Language: Go
- Homepage:
- Size: 45.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
> [!WARNING]
> This project is not maintained anymore due to its transpiled size, lack of tests and no need for such a library.
> Please use [js-cvss](https://github.com/pandatix/js-cvss) or an alternative.It currently supports :
- [ ] [CVSS 2.0](https://www.first.org/cvss/v2/guide)
- [ ] [CVSS 3.0](https://www.first.org/cvss/v3.0/specification-document)
- [ ] [CVSS 3.1](https://www.first.org/cvss/v3.1/specification-document)
- [X] [CVSS 4.0](https://www.first.org/cvss/v4.0/specification-document)## How to use
### API
The API provides multiple ways to handle CVSS v4.0:
- as an in-browser global script: ``
- as a Node module: `m = require("./gojs-cvss.js")`From the global/module import, you have:
- the `CVSS40` type that you can create either with `vec = new CVSS40()` or `vec = m.cvss40.New()`
- the `Rating` method that cou can call with `Rating(...)` or `m.Rating(...)`, takes a Number and returns a 2-objects slice composed of the rating (`String` or `null`) and an error message (`String` or `null`) if the value is out of boundsThe `CVSS40` object has multiple methods:
- `Parse(vector)`: takes a CVSS v4.0 string representation to parse it and returns an error message (`String` or `null`)
- `Vector()`: returns the string representation (`String`) of the CVSS v4.0 object.
- `Get(metric)`: takes the metric (`String`) to get and returns a 2-objects slice composed of the metric value (`String` or `null`) and an error message (`String` or `null`)
- `Set(metric, value)`: takes the metric and the value (`String`) to set it to, and returns an error message (`String` or `null`)
- `Score()`: returns the score of the CVSS v4.0 object (`Number`)
- `Nomenclature()`: returns the nomenclature of the CVSS v4.0 object (`String`)The [examples](examples) are equivalent and shows how to parse a CVSS v4.0 string representation, change a metric value, compute its score+nomenclature and print the new vector.