Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
A really small and type-safe (requires TypeScript >= 4.1.3) function, that gets a nested value from an object using a path string (like 'a.b[0].d'). If value is 'undefined' or unreachable returns the placeholder instead.
@bitty/get
A really small and type-safe (requires TypeScript >= 4.1.3) function, that gets a nested value from an object using a path string (like "a.b[0].d"
). If value is undefined
or unreachable returns the placeholder instead.
📦 Distributions in ESM, CommonJS, UMD and UMD minified formats.
import
/export
) and CommonJS (require
/module.exports
).⚡ Lightweight:
🔋 Batteries included:
🏷 Safe:
It's approach is based on idx, from Facebook, and an insight from a Vue.js meetup where @IgorHalfeld showed a way to get nested values using eval
.
This library is published in the NPM registry and can be installed using any compatible package manager.
npm install --save @bitty/get
# If you're using Yarn use the command below.
yarn add @bitty/get
This module has a UMD bundle available through JSDelivr and Unpkg CDNs.
<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/@bitty/get"></script>
<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/@bitty/get"></script>
<script>
// UMD module is exposed through the "get" global function.
console.log(get);
//=> "[Function: get]"
var users = [{ name: 'Carlos Marcos' }];
console.log(get(users, '[0].name', 'Unknown'));
//=> "Carlos Marcos"
</script>
Just import get
function and gets a value from object using a path expression.
import get from '@bitty/get';
// ...
const name = get(response, 'data.user.name', 'Unknown');
You can use brackets, even on first property.
const title = get(paragraphs, '[0].children[0].textContent');
Released under MIT License.
FAQs
A really small and type-safe (requires TypeScript >= 4.1.3) function, that gets a nested value from an object using a path string (like 'a.b[0].d'). If value is 'undefined' or unreachable returns the placeholder instead.
The npm package @bitty/get receives a total of 0 weekly downloads. As such, @bitty/get popularity was classified as not popular.
We found that @bitty/get demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.