
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
dot-notation-tokenizer
Advanced tools
Convert a dot notation string into a tokenized array.
yarn
yarn add dot-notation-tokenizer
npm
npm i dot-notation-tokenizer
import { tokenize } from 'dot-notation-tokenizer'
tokenize('dot.notation')
<script src="path/to/script/index.min.js"></script>
<script>
dotNotationTokenizer.tokenize('dot.notation')
</script>
const { tokenize } = require('dot-notation-tokenizer')
tokenize('dot.notation')
Dot notation can consist of basic property keys seperated by a .
and also array indexes within [x]
like the following.
path.to.array[1]
The above notation would return the following token array.
[
{
"kind": "PROPERTY",
"value": "path",
"index": {
"start": 0,
"end": 4
},
"raw": "path"
},
{
"kind": "PROPERTY",
"value": "to",
"index": {
"start": 5,
"end": 7
},
"raw": "to"
},
{
"kind": "PROPERTY",
"value": "array",
"index": {
"start": 8,
"end": 13
},
"raw": "array"
},
{
"kind": "ARRAY_INDEX",
"value": 1,
"index": {
"start": 14,
"end": 16
},
"text": "[1]"
}
]
The notation used above would be used to access the second array value in the following object.
The value returned would be 2
.
{
"path": {
"to": {
"array": [
1,
2,
3
]
}
}
}
You can also chain array indexes for nested arrays like the following notation.
path.to.deep.array[1][0][4]
If you need to include .
, [
or ]
in your array key you can simply escape it by putting a slash \
in front of the character.
escaped\\.property\\[0\\].withindex
The above notation would return the following tokens.
[
{
"kind": "PROPERTY",
"value": "escaped.property[0]",
"index": {
"start": 0,
"end": 22
},
"raw": "escaped\\.property\\[0\\]"
},
{
"kind": "PROPERTY",
"value": "withindex",
"index": {
"start": 23,
"end": 32
},
"raw": "withindex"
}
]
FAQs
Dot notation tokenizer
The npm package dot-notation-tokenizer receives a total of 6 weekly downloads. As such, dot-notation-tokenizer popularity was classified as not popular.
We found that dot-notation-tokenizer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.