New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pick-by-alias

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pick-by-alias

Pick properties by aliases

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
219K
increased by3.1%
Maintainers
1
Weekly downloads
 
Created
Source

pick-by-alias unstable

Pick object properties by a list of aliases. May not sound as a great idea for API design, but that is really useful to avoid remembering exact option names from user point.

npm install pick-by-alias

let pick = require('pick-by-alias')

let options = pick({
  positions: [...],
  color: 'rgba(0, 100, 200, .75)',
  viewBox: null,
  extra: 123
}, {
	positions: ['positions', 'points', 'data', 'coordinates'],
	color: ['colors', 'color', 'stroke'],
	viewport: ['viewport', 'viewBox']
})

// options === {positions, color, viewport}

result = pick(source, aliases)

Return an object consisting of the properties picked by the list of aliases. The aliases are matched in priority order, ie. the names going first are picked. Each alias can be an array or a comma/space-separated string.

License

(c) 2017 Dima Yv. MIT License

Keywords

FAQs

Package last updated on 17 Sep 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc