Skip to content

Instantly share code, notes, and snippets.

@jhyland87
Created July 5, 2017 21:00
Show Gist options
  • Save jhyland87/5873d936015d3bd23552f6c9722ebda2 to your computer and use it in GitHub Desktop.
Save jhyland87/5873d936015d3bd23552f6c9722ebda2 to your computer and use it in GitHub Desktop.
'use strict'
const _ = require('lodash')
const AppRoot = require('app-root-path')
const Util = require('util')
var Confidence = require('confidence');
var manifest = {
buttons: {
// Panel control buttons (maximize, minimize, refresh, close)
panelctrl: {
element: 'a',
shape: 'circle',
size: 'xs',
href: 'javascript:;',
props: {
data: {
// Any additional props for the links
}
},
icon: {
$filter : "type",
expand : 'expand',
reload : 'repeat',
collapse : 'minus',
close : 'times',
$default : 'question'
},
color: {
$filter : "type",
expand : 'success',
reload : 'default',
collapse : 'warning',
close : 'danger',
$default : 'default'
},
panel: {
$filter : "type",
expand : 'expand',
reload : 'reload',
collapse : 'collapse',
close : 'remove',
$default : 'expand'
}
}
}
}
var criteria = {
type: 'reload'
}
const store = new Confidence.Store(manifest)
const storeGet = _.partialRight(store.get.bind(store), criteria)
console.log('storeGet:',storeGet('/'))
/*
Result:
storeGet: { buttons:
{ panelctrl:
{ element: 'a',
shape: 'circle',
size: 'xs',
href: 'javascript:;',
props: [Object],
icon: 'repeat',
color: 'default',
panel: 'reload' } } }
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment