StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
718 B
41 lines
718 B
4 years ago
|
# Accessor function
|
||
|
|
||
|
A wrapper for property accessors supporting functions, property strings or constant values.
|
||
|
|
||
|
[](https://nodei.co/npm/accessor-fn/)
|
||
|
|
||
|
## Quick start
|
||
|
|
||
|
```
|
||
|
import accessorFn from 'accessor-fn';
|
||
|
```
|
||
|
or
|
||
|
```
|
||
|
var accessorFn = require('accessor-fn');
|
||
|
```
|
||
|
or even
|
||
|
```
|
||
|
<script src="//unpkg.com/accessor-fn"></script>
|
||
|
```
|
||
|
|
||
|
## Usage example
|
||
|
|
||
|
Given an object
|
||
|
```
|
||
|
var obj = {
|
||
|
a: 1,
|
||
|
b: 2
|
||
|
}
|
||
|
```
|
||
|
|
||
|
Use `accessorFn` to access object values via property strings or transformation functions:
|
||
|
```
|
||
|
var aFn = accessorFn('a');
|
||
|
aFn(obj); // 1
|
||
|
|
||
|
var sumFn = accessorFn(d => d.a + d.b);
|
||
|
sumFn(obj); // 3
|
||
|
|
||
|
var constantFn = accessorFn(7);
|
||
|
constantFn(obj); // 7
|
||
|
```
|