
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
babel-plugin-object-path-get-to-optional-chaining
Advanced tools
> This plugin replaces objectPath.get ([object-path](https://github.com/mariocasciaro/object-path)) to [new optional chaining syntax](https://babeljs.io/docs/en/next/babel-plugin-proposal-optional-chaining.html) and remove unused object-path imports.
This plugin replaces objectPath.get (object-path) to new optional chaining syntax and remove unused object-path imports.
WORKING ONLY WITH BABEL 7. THIS PLUGIN NOT WORKING WITH BABEL 6.
Babel install:
npm install --save-dev @babel/core @babel/cli @babel/preset-env
Plugin install:
npm i -D babel-plugin-object-path-get-to-optional-chaining
.babelrc
{
"presets": [ "@babel/env" ],
"plugins": [
"object-path-get-to-optional-chaining"
]
}
./node_modules/.bin/babel src --out-dir src
from:
import objectPath from 'object-path'
objectPath.get(foo, 'bar.baz')
objectPath.get(foo.bar.baz.bar, 'baz')
objectPath.get(foo.bar, 'baz.bar')
to:
foo?.bar?.baz;
foo.bar.baz.bar?.baz;
foo.bar?.baz?.bar;
from:
import { get, set } from 'object-path'
get(foo, 'bar.baz')
get(foo.bar.baz.bar, 'baz')
get(foo.bar, 'baz.bar')
to:
import { set } from 'object-path';
foo?.bar?.baz;
foo.bar.baz.bar?.baz;
foo.bar?.baz?.bar;
from:
import { get } from 'object-path'
get(foo, 'bar.baz')
get(foo.bar.baz.bar, 'baz')
get(foo.bar, 'baz.bar')
to:
foo?.bar?.baz;
foo.bar.baz.bar?.baz;
foo.bar?.baz?.bar;
from:
import { get as objGet } from 'object-path'
objGet(foo, 'bar.baz')
objGet(foo.bar.baz.bar, 'baz')
objGet(foo.bar, 'baz.bar')
to:
foo?.bar?.baz;
foo.bar.baz.bar?.baz;
foo.bar?.baz?.bar;
from:
import { get as objGet, set as objSet } from 'object-path'
objGet(foo, 'bar.baz')
objGet(foo.bar.baz.bar, 'baz')
objGet(foo.bar, 'baz.bar')
to:
import { set as objSet } from 'object-path';
foo?.bar?.baz;
foo.bar.baz.bar?.baz;
foo.bar?.baz?.bar;
from:
import objectPath, { get as objGet, set as objSet } from 'object-path'
objGet(foo, 'bar.baz')
objGet(foo.bar.baz.bar, 'baz')
objGet(foo.bar, 'baz.bar')
to:
import { set as objSet } from 'object-path';
foo?.bar?.baz;
foo.bar.baz.bar?.baz;
foo.bar?.baz?.bar;
from:
import objectPath, { get as objGet, set as objSet } from 'object-path'
objGet(foo, 'bar.baz')
objGet(foo.bar.baz.bar, 'baz')
objGet(foo.bar, 'baz.bar')
objectPath.set(foo, 'baz')
to:
import objectPath, { set as objSet } from 'object-path';
foo?.bar?.baz;
foo.bar.baz.bar?.baz;
foo.bar?.baz?.bar;
objectPath.set(foo, 'baz');
from:
import objectPath, { get as objGet, set as objSet } from 'object-path'
objGet(foo, 'bar.baz')
objGet(foo.bar.baz.bar, 'baz')
objGet(foo.bar, 'baz.bar')
objectPath[cond ? 'get' : 'set'](foo, 'bar')
to:
import objectPath, { set as objSet } from 'object-path';
foo?.bar?.baz;
foo.bar.baz.bar?.baz;
foo.bar?.baz?.bar;
objectPath[cond ? 'get' : 'set'](foo, 'bar');
FAQs
> This plugin replaces objectPath.get ([object-path](https://github.com/mariocasciaro/object-path)) to [new optional chaining syntax](https://babeljs.io/docs/en/next/babel-plugin-proposal-optional-chaining.html) and remove unused object-path imports.
The npm package babel-plugin-object-path-get-to-optional-chaining receives a total of 1 weekly downloads. As such, babel-plugin-object-path-get-to-optional-chaining popularity was classified as not popular.
We found that babel-plugin-object-path-get-to-optional-chaining 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
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.