Gathering detailed insights and metrics for osrm-text-instructions
Gathering detailed insights and metrics for osrm-text-instructions
Gathering detailed insights and metrics for osrm-text-instructions
Gathering detailed insights and metrics for osrm-text-instructions
npm install osrm-text-instructions
Typescript
Module System
Node Version
NPM Version
93.8
Supply Chain
92.7
Quality
84
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
2,197,730
Last Day
735
Last Week
9,953
Last Month
63,018
Last Year
688,085
89 Stars
621 Commits
64 Forks
60 Watching
19 Branches
56 Contributors
Latest Version
0.15.0
Package Id
osrm-text-instructions@0.15.0
Unpacked Size
2.51 MB
Size
278.16 kB
File Count
844
NPM Version
8.19.4
Node Version
16.20.2
Publised On
03 Mar 2024
Cumulative downloads
Total Downloads
Last day
-72.8%
735
Compared to previous day
Last week
-31.3%
9,953
Compared to previous week
Last month
-0.8%
63,018
Compared to previous month
Last year
44.5%
688,085
Compared to previous year
5
OSRM Text Instructions is a Node.js library that transforms route data generated by OSRM into localized turn instructions to be displayed visually or read aloud by a text-to-speech engine. OSRM Text Instructions is the basis of guidance instructions in osrm-frontend, the Mapbox Directions API, and the Mapbox Navigation SDK.
1var version = 'v5'; 2var osrmTextInstructions = require('osrm-text-instructions')(version); 3 4response.legs.forEach(function(leg) { 5 leg.steps.forEach(function(step) { 6 instruction = osrmTextInstructions.compile('en', step, options) 7 }); 8});
If you are unsure if the user's locale is supported by osrm-text-inustrctions, use @mapbox/locale-utils for finding the best fitting language.
require('osrm-text-instructions')(version)
parameter | required? | values | description |
---|---|---|---|
version | required | v5 | Major OSRM version |
compile(language, step, options)
parameter | required? | values | description |
---|---|---|---|
language | required | en de zh-Hans fr nl ru and more | Compiling instructions for the selected language code. |
step | required | OSRM route step object | The RouteStep as it comes out of OSRM |
options | optional | Object | See below |
key | type | description |
---|---|---|
legCount | integer | Number of legs in the route |
legIndex | integer | Zero-based index of the leg containing the step; together with legCount , this option determines which waypoint the user has arrived at |
formatToken | function | Function that formats the given token value after grammaticalization and capitalization but before the value is inserted into the instruction string; useful for wrapping tokens in markup |
waypointName | string | Optional custom name for the leg's destination, replaces "your {nth} destination" |
formatToken
takes two parameters:
token
: A string that indicates the kind of token, such as way_name
or direction
value
: A grammatical string for this token, capitalized if the token appears at the beginning of the instructionand returns a string.
We welcome feedback, code contributions, and translations! Please see CONTRIBUTING.md for details.
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
3 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More