Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
osrm-text-instructions
Advanced tools
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.
var version = 'v5';
var osrmTextInstructions = require('osrm-text-instructions')(version);
response.legs.forEach(function(leg) {
leg.steps.forEach(function(step) {
instruction = osrmTextInstructions.compile('en', step, options)
});
});
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.
FAQs
OSRM Text Instructions
The npm package osrm-text-instructions receives a total of 13,313 weekly downloads. As such, osrm-text-instructions popularity was classified as popular.
We found that osrm-text-instructions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.