pick-by-alias

WebJar for pick-by-alias

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

pick-by-alias
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

pick-by-alias
WebJar for pick-by-alias
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/dfcreative/pick-by-alias

Download pick-by-alias

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/pick-by-alias/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>pick-by-alias</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/pick-by-alias/
implementation 'org.webjars.npm:pick-by-alias:1.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/pick-by-alias/
implementation ("org.webjars.npm:pick-by-alias:1.2.0")
'org.webjars.npm:pick-by-alias:jar:1.2.0'
<dependency org="org.webjars.npm" name="pick-by-alias" rev="1.2.0">
  <artifact name="pick-by-alias" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='pick-by-alias', version='1.2.0')
)
libraryDependencies += "org.webjars.npm" % "pick-by-alias" % "1.2.0"
[org.webjars.npm/pick-by-alias "1.2.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

pick-by-alias unstable

Pick object properties by synonyms. Useful to avoid remembering exact option names from user perspective. That should be applied in experimental packages to identify cow paths (ie. most frequently used names) and removed once package gets stable status.

npm install pick-by-alias

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

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

pick(object, properties, keepRest=false)

Return an object with properties picked by the list or dict with aliases. Aliases are matched in priority order, ie. first matching name is picked. Each alias can be an array or a comma/space-separated string.

// pick by dict
let {a, b} = pick(src, {a: ['a', 'b', 'c'], b: 'd e f'})

// pick by list
let {c, d, e} = pick(src, ['c', 'd', 'e'])

// pick by string
let {f, g} = pick(src, 'f g')

keepRest defines if not listed object properties should be transfered to resulting object or discarded.

Related

  • defined − get first non-undefined out of a list of values

License

(c) 2017 Dmitry Yv. MIT License

Versions

Version
1.2.0