Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@azuro-org/dictionaries
Advanced tools
CLI and set of helpers to work with Azuro protocol dictionaries
This package provides 2 features: CLI to download dictionaries; helpers to work with dictionaries.
npm i --save @azuro-org/dictionaries
All dictionaries stored in public repository. For ease of use, the dictionaries have a version and file format.
It's easy to download dictionary files with CLI. In your package.json add script:
"scripts": {
"get-dicts": "dictionaries -o {OUTPUT_DIR} -v {VERSION} -t {FILES_TYPE}"
}
VERSION
is the version of downloaded dictionaries. Find the version you need here.OUTPUT_DIR
is the directory where to put downloaded files.FILES_TYPE
is the extension of downloaded files. Accepts ts
, js
, maps
, arrays
. maps
and arrays
are
json files with different output format.dictionaries -o ./dist -v 2.0.0 -t ts # will download v2.0.0 typescript files to ./dist directory
import { getMarketKey, getMarketName, getMarketDescription, assembleMarketName, assembleSelectionName } from '@azuro-org/dictionaries'
import { getMarketKey } from '@azuro-org/dictionaries'
import dictionaries from './path-to-downloaded-dictionaries'
const outcomeId = 1
const marketKey = getMarketKey(outcomeId, dictionaries)
getMarketKey(outcomeId, dictionaries)
returns the string key marketId-gamePeriodId-gameTypeId[-teamPlayerId]
built from the dictionaries related to passed outcomeId
.
In the example above the result is 1-1-1
.
There are two dictionary files marketNames.js
and marketDescriptions.js
. marketKey
is used to receive market name
and description for specific outcome ID.
import dictionaries from './path-to-downloaded-dictionaries'
dictionaries.marketNames['1-1-1'] // "Full Time Result"
dictionaries.marketDescriptions['1-1-1'] // "You predict the result..."
!!! Note that there are no texts for each outcomeId
!!!
marketNames[marketKey]
and marketDescriptions[marketKey]
may return undefined
. For marketName
generation there
is other helper assembleMarketName
. It generates human readable market name based on outcome marketId
, gamePeriodId
,
gameTypeId
, teamPlayerId
.
import { getMarketKey, assembleMarketName } from '@azuro-org/dictionaries'
import dictionaries from './path-to-downloaded-dictionaries'
const outcomeId = 42
const marketKey = getMarketKey(outcomeId, dictionaries)
let marketName = dictionaries[marketKey] // undefined
if (!marketName) {
marketName = assembleMarketName(outcomeId, dictionaries) // "Whole game - Winner of match Goal"
}
There are additional 2 sugar helpers:
import { getMarketName } from '@azuro-org/dictionaries'
import dictionaries from './path-to-downloaded-dictionaries'
getMarketName(1, dictionaries) // "Full Time Result"
getMarketName(42, dictionaries) // "Whole game - Winner of match Goal"
import { getMarketDescription } from '@azuro-org/dictionaries'
import dictionaries from './path-to-downloaded-dictionaries'
getMarketDescription(1, dictionaries) // "You predict the result..."
getMarketDescription(42, dictionaries) // undefined. Note that there is no `assemblyMarketDescription` helper.
import { assembleSelectionName } from '@azuro-org/dictionaries'
import dictionaries from './dist'
const outcomeId = 1
const selectionName = assembleSelectionName(outcomeId, dictionaries) // "Yes"
const outcomeId = 4
const selectionName = assembleSelectionName(outcomeId, dictionaries) // "Team 2 (4.5)"
FAQs
CLI and set of helpers to work with Azuro protocol dictionaries
The npm package @azuro-org/dictionaries receives a total of 276 weekly downloads. As such, @azuro-org/dictionaries popularity was classified as not popular.
We found that @azuro-org/dictionaries demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.