Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@bitty/get
Advanced tools
Readme
@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 30 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.