
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@g2crowd/extract-options
Advanced tools
This package is responsible for extracting a subset of a hash, based on a namespaced key.
It is useful for reading options out of DOM data attributes, where there may be multiple keys with different concerns.
npm install @g2crowd/extract-options --save
This will create a new hash, seperating out keys based on a common prefix:
import { extractOptions } from '@g2crowd/extract-options';
const startingHash = { prefixOne: 1, prefixTwo: 2, otherKey: 3 };
extractOptions(startingHash, 'prefix'); //=> { one: 1, two: 2 }
It will treat keys with an Options
suffix as special. It will expect a hash of raw options to follow:
const startingHash = { prefixOne: 1, prefixTwo: 2, otherKey: 3, prefixOptions: { three: 3 } };
extractOptions(startingHash, 'prefix'); //=> { one: 1, two: 2, three: 3 }
Pairs nicely with jQuery.data
:
<div id="element" data-prefix-one="1" data-prefix-two="2" data-other-key="3"></div>
let data = $('#element').data();
const options = extractOptions(data, 'prefix'); //=> { one: 1, two: 2 }
FAQs
Pull namespaced options out of a hash
The npm package @g2crowd/extract-options receives a total of 11 weekly downloads. As such, @g2crowd/extract-options popularity was classified as not popular.
We found that @g2crowd/extract-options demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.