Add pick to frptools. Document all utility functions

This commit is contained in:
Timothy Farrell 2017-12-31 04:50:24 -06:00
parent 393c9f5e26
commit a8a55654d8
2 changed files with 3 additions and 4 deletions

View File

@ -1,8 +1,7 @@
import { prop, computed, container } from 'frptools'; import { prop, computed, container, pick } from 'frptools';
import { Icon } from './icon.js'; import { Icon } from './icon.js';
import { defineElement as el, subscribeToRender } from '../../utils/domvm.js'; import { defineElement as el, subscribeToRender } from '../../utils/domvm.js';
import { pick } from '../../utils/conversion.js';
import { injectStyle, styled } from '../../services/style.js'; import { injectStyle, styled } from '../../services/style.js';
import { CLICKABLE } from '../styles.js'; import { CLICKABLE } from '../styles.js';

View File

@ -1,4 +1,6 @@
import { readAsArrayBuffer } from 'pouchdb-binary-utils'; import { readAsArrayBuffer } from 'pouchdb-binary-utils';
import { pick } from 'frptools';
import { isObject } from './comparators'; import { isObject } from './comparators';
export function bufferToHexString(buffer) { export function bufferToHexString(buffer) {
@ -45,8 +47,6 @@ export function deepAssign(to, ...rest) {
return to; return to;
} }
export const pick = (id, def) => doc => (doc && doc.hasOwnProperty(id) ? doc[id] : def);
export const extractID = pick('_id'); export const extractID = pick('_id');
export const extractREV = pick('_rev'); export const extractREV = pick('_rev');