zazzy-browser
Advanced tools
Comparing version 1.1.5 to 1.1.6
//! zzb.js | ||
//! version: 1.1.5 | ||
//! version: 1.1.6 | ||
//! author(s): Jaret Pfluger | ||
@@ -1246,4 +1246,3 @@ //! license: MIT | ||
// ValueError :: String -> Error | ||
var formatValueError = function (message) { | ||
function ValueError (message) { | ||
var err = new Error(message) | ||
@@ -1254,18 +1253,2 @@ err.name = 'ValueError' | ||
// defaultTo :: a,a? -> a | ||
var formatDefaultTo = function (x, y) { | ||
return y == null ? x : y | ||
} | ||
var formatLookup = function (obj, path) { | ||
if (!/^\d+$/.test(path[0])) { | ||
path = ['0'].concat(path) | ||
} | ||
for (var idx = 0; idx < path.length; idx += 1) { | ||
var key = path[idx] | ||
obj = typeof obj[key] === 'function' ? obj[key]() : obj[key] | ||
} | ||
return obj | ||
} | ||
// https://github.com/davidchambers/string-format | ||
@@ -1291,9 +1274,10 @@ // create :: Object -> String,*... -> String | ||
/([{}])\1|[{](.*?)(?:!(.+?))?[}]/g, | ||
function (match, literal, key, xf) { | ||
function (match, literal, _key, xf) { | ||
if (literal != null) { | ||
return literal | ||
} | ||
var key = _key | ||
if (key.length > 0) { | ||
if (state === 'IMPLICIT') { | ||
throw formatValueError('cannot switch from ' + | ||
throw ValueError('cannot switch from ' + | ||
'implicit to explicit numbering') | ||
@@ -1304,3 +1288,3 @@ } | ||
if (state === 'EXPLICIT') { | ||
throw formatValueError('cannot switch from ' + | ||
throw ValueError('cannot switch from ' + | ||
'explicit to implicit numbering') | ||
@@ -1312,4 +1296,18 @@ } | ||
} | ||
var value = formatDefaultTo('', formatLookup(args, key.split('.'))) | ||
// 1. Split the key into a lookup path. | ||
// 2. If the first path component is not an index, prepend '0'. | ||
// 3. Reduce the lookup path to a single result. If the lookup | ||
// succeeds the result is a singleton array containing the | ||
// value at the lookup path; otherwise the result is []. | ||
// 4. Unwrap the result by reducing with '' as the default value. | ||
var path = key.split('.') | ||
var value = (/^\d+$/.test(path[0]) ? path : ['0'].concat(path)) | ||
.reduce(function (maybe, key) { | ||
return maybe.reduce(function (_, x) { | ||
return x != null && key in Object(x) ? [typeof x[key] === 'function' ? x[key]() : x[key]] : [] | ||
}, []) | ||
}, [args]) | ||
.reduce(function (_, x) { return x }, '') | ||
if (xf == null) { | ||
@@ -1320,3 +1318,3 @@ return value | ||
} else { | ||
throw formatValueError('no transformer named "' + xf + '"') | ||
throw ValueError('no transformer named "' + xf + '"') | ||
} | ||
@@ -1323,0 +1321,0 @@ } |
//! zzb.js | ||
//! version: 1.1.5 | ||
//! version: 1.1.6 | ||
//! author(s): Jaret Pfluger | ||
//! license: MIT | ||
//! https://github.com/jpfluger/zazzy-browser | ||
!function s(o,a,l){function u(e,t){if(!a[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(d)return d(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[e]={exports:{}};o[e][0].call(i.exports,function(t){return u(o[e][1][t]||t)},i,i.exports,s,o,a,l)}return a[e].exports}for(var d="function"==typeof require&&require,t=0;t<l.length;t++)u(l[t]);return u}({1:[function(t,e,r){var n=window.$;function i(){this.ajax=function(o){return new Promise(function(i,s){n.ajax(o).done(function(t,e,r){if(o.RAWRETURN)return i(t);if(!t)return s(new Error("Data returned is empty when at minimum a status is required"));var n=zzb.rob.newROB();if(r.responseJSON){if(t.redirect&&0<t.redirect.length)return void(window.location.href=t.redirect);t.ISROBERRORS||(t.err?(t.errs=zzb.rob.sanitizeErrors(t.err),t.err=null):t.error?(t.error=zzb.rob.sanitizeErrors(t.error),t.error=null):t.errs&&(t.errs=zzb.rob.sanitizeErrors(t.errs),t.err=null)),t.ISROBRECS||(t.recs?t.recs=zzb.rob.sanitizeRecords(t.recs):t.rec?(t.recs=zzb.rob.sanitizeRecords(t.rec),t.rec=null):t.recs=zzb.rob.sanitizeRecords(t)),t.paginate&&(n.paginate=t.paginate),n.errs=t.errs,n.recs=t.recs,n.fields=t.fields}else n.recs=[t];i(n)}).fail(function(t,e,r){s(r),console.log(r)})})}}i.prototype.get=function(t){return t.type="GET",t.contentType="application/json; charset=UTF-8",t.data=JSON.stringify(t.data),this.ajax(t)},i.prototype.getJSON=function(t){return t.type="GET",t.dataType="json",t.contentType="application/json; charset=UTF-8",t.data=JSON.stringify(t.data),this.ajax(t)},i.prototype.postJSON=function(t){return t.type="POST",t.dataType="json",t.contentType="application/json; charset=UTF-8",t.data=JSON.stringify(t.data),this.ajax(t)},r.ajax=i},{}],2:[function(t,e,r){var o=window._,a=function(t){this.defaultOptions=a.getDialogDefaults(t),this.defaultOptions.onShow="function"==typeof t.onShow?t.onShow:function(){},this.defaultOptions.onShown="function"==typeof t.onShown?t.onShown:function(){},this.defaultOptions.onHide="function"==typeof t.onHide?t.onHide:function(){},this.defaultOptions.onHidden="function"==typeof t.onHidden?t.onHidden:function(){}};a.getButtonDefaults=function(t){var e={id:null,type:a.TYPE_NONE,label:"",className:"",action:null,isDismiss:!1,isOutline:!1};return zzb.types.isObject(t)?o.merge(e,t):e},a.getDialogDefaults=function(t){var e={id:zzb.uuid.newV4(),type:a.TYPE_NONE,className:"",title:"",body:"",buttons:[],onShow:null,onShown:null,onHide:null,onHidden:null,doVerticalCenter:!0,doAutoDestroy:!0};return zzb.types.isObject(t)?o.merge(e,t):e},a.BUTTON_CLOSE="button-close",a.BUTTON_OK="button-ok",a.BUTTON_YES="button-yes",a.BUTTON_NO="button-no",a.BUTTON_CANCEL="button-cancel",a.TYPE_NONE="none",a.TYPE_PRIMARY="primary",a.TYPE_SECONDARY="secondary",a.TYPE_SUCCESS="success",a.TYPE_DANGER="danger",a.TYPE_WARNING="warning",a.TYPE_INFO="info",a.TYPE_LIGHT="light",a.TYPE_DARK="dark",a.TYPE_LINK="link",a.getButtonPreset=function(t,e,r){var n=a.getButtonDefaults();switch(n.isDismiss=!0,e===r-1?n.type=a.TYPE_PRIMARY:e===r-2&&(n.type=a.TYPE_SECONDARY),t){case"button-close":n.label="Close";break;case"button-ok":n.label="Ok";break;case"button-accept":n.label="Accept";break;case"button-yes":n.label="Yes";break;case"button-no":n.label="No";break;case"button-cancel":n.label="Cancel";break;default:n=null}return n},a.validateType=function(t){if(!t)return a.TYPE_NONE;switch(t){case a.TYPE_PRIMARY:case a.TYPE_SECONDARY:case a.TYPE_SUCCESS:case a.TYPE_DANGER:case a.TYPE_WARNING:case a.TYPE_INFO:case a.TYPE_LIGHT:case a.TYPE_DARK:case a.TYPE_LINK:return t;default:return a.TYPE_NONE}},a.isTypeNone=function(t){return a.validateType(t)===a.TYPE_NONE},a.prototype.getId=function(){return zzb.types.isNonEmptyString(this.defaultOptions.id)||(this.defaultOptions.id=zzb.uuid.newV4()),this.defaultOptions.id},a.prototype.getClassName=function(){return zzb.types.isNonEmptyString(this.defaultOptions.className)||(this.defaultOptions.className=""),this.defaultOptions.className},a.prototype.getTitle=function(){return zzb.types.isNonEmptyString(this.defaultOptions.title)||(this.defaultOptions.title=""),this.defaultOptions.title},a.prototype.getBody=function(){return zzb.types.isNonEmptyString(this.defaultOptions.body)||(this.defaultOptions.body=""),this.defaultOptions.body},a.prototype.create$Modal=function(){var t={id:this.getId(),arialabel:"arialabel"+this.getId(),className:this.getClassName(),title:this.getTitle(),body:this.getBody(),classVerticalCenter:this.defaultOptions.doVerticalCenter?" modal-dialog-centered":"",classModalHeader:""};a.isTypeNone(this.defaultOptions.type)||(t.classModalHeader+=" alert-"+this.defaultOptions.type);var n=$(zzb.strings.format('<div class="modal fade modal-fullscreen {cssClass}" id="{id}" tabindex="-1" role="dialog" aria-labelledby="{arialabel}" aria-hidden="true"><div class="modal-dialog{classVerticalCenter}" role="document"><div class="modal-content"><div class="modal-header{classModalHeader}"><h5 class="modal-title" id="{arialabel}">{title}</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body">{body}</div><div class="modal-footer"></div></div></div></div>',t));Array.isArray(this.defaultOptions.buttons)||(this.defaultOptions.buttons=[]);var i=this,s=this.defaultOptions.buttons.length;return o.each(this.defaultOptions.buttons,function(t,e){if(zzb.types.isNonEmptyString(t)&&(t=a.getButtonPreset(t,e,s)),zzb.types.isObject(t)){zzb.types.isNonEmptyString(t.id)||(t.id="button-"+e+"-"+i.getId()),t.isDismiss&&(zzb.types.isFunction(t.action)||(t.action=function(t,e){t.close()}),n.find(".modal-header button.close").attr("aria-label",t.label)),a.isTypeNone(t.type)||(t.isOutline?t.className+=" btn-outline-"+t.type:t.className+=" btn-"+t.type);var r=$(zzb.strings.format('<button id="{id}" type="button" class="btn {className}">{label}</button>',t));r.data("button",t),r.on("click",{dialog:i,$button:r,button:t},function(t){var e=t.data.dialog,r=t.data.$button,n=r.data("button");if("function"==typeof n.action)return n.action.call(r,e,t)}),0<n.find(".modal-footer > button").length?r.insertAfter(n.find(".modal-footer > button").last()):n.find(".modal-footer").append(r)}}),n},a.prototype.open=function(){if(!this.$modal){this.$modal=this.create$Modal();var e=this;this.$modal.on("show.bs.modal",function(t){e.onShow(t)}),this.$modal.on("shown.bs.modal",function(t){e.onShown(t)}),this.$modal.on("hide.bs.modal",function(t){e.onHide(t)}),this.$modal.on("hidden.bs.modal",function(t){e.onHidden(t)})}this.$modal.modal("show"),this.$modal.appendTo("body")},a.prototype.onShow=function(t){this.defaultOptions.onShow(t,this,this.$modal)},a.prototype.onShown=function(t){this.defaultOptions.onShown(t,this,this.$modal)},a.prototype.onHide=function(t){this.defaultOptions.onHide(t,this,this.$modal)},a.prototype.onHidden=function(t){this.defaultOptions.onHidden(t,this,this.$modal),this.defaultOptions.doAutoDestroy&&this.$modal.remove()},a.prototype.close=function(){this.$modal.modal("hide")},a.prototype.hide=function(){this.$modal.modal("hide"),this.$modal.modal("dispose"),0<$("#"+this.getId()).length&&$("#"+this.getId()).remove(),this.$modal=null};var n=function(){};n.prototype.ZazzyDialog=a,n.prototype.modal=function(t){return new a(t)},n.prototype.showMessage=function(t){zzb.dialogs.modal(o.merge({type:a.TYPE_NONE,buttons:[a.BUTTON_OK]},t)).open()},n.prototype.showMessageChoice=function(t){zzb.dialogs.modal(o.merge({type:a.TYPE_NONE,buttons:[a.BUTTON_CANCEL,a.getButtonDefaults({type:a.TYPE_PRIMARY,label:"Accept",action:function(t,e){t.close()}})]},t)).open()},n.prototype.handleError=function(t){if((t=o.merge({log:null,type:a.TYPE_DANGER,title:"",body:'<div class="zzb-dialog-errors">{errors}</div><div class="zzb-dialog-message">{message}</div>',message:"",errs:null,errors:"",buttons:[a.getButtonDefaults({type:a.TYPE_DANGER,label:"Ok",action:function(t,e){t.close()}})]},t)).log&&console.log(t.log),!zzb.types.isNonEmptyString(t.errors)&&zzb.types.isArray(t.errs)){var r=[];o.each(t.errs,function(t,e){t.message&&zzb.types.isNonEmptyString(t.message)&&r.push(zzb.strings.format('<div class="zzb-dialog-error-item">{0}</div>',t.message))}),t.errors=r.join("\n")}t.body=zzb.strings.format(t.body,t),this.showMessage(t)},r.dialogs=n},{}],3:[function(t,e,r){var u=window.$,d=window._,n=function(){},i=function(t,n){var i=[],s=[];if(!t||0===t.length||!t[0]){if(n.hideWhenNoError)return{html:null,contentPopOver:null};t=[{type:"success",message:null}]}return d.each(t,function(t,e){if(t.field||(t.field="_system"),"_system"===t.field)i.push(zzb.strings.format("<div>{0}</div>",t.message));else{var r=n.typeFormats.error;t.type&&n.typeFormats[t.type]&&(r=n.typeFormats[t.type]),0===e&&i.push(zzb.strings.format('<span class="glyphicon {0} {1}"></span>',r.glyph,r.textClass)),t.message&&zzb.types.isNonEmptyString(t.message)&&s.push(t.message)}}),{html:i.join(" "),contentPopOver:s.join(" ")}},s=function(t){t.$elem&&0<t.$elem.length&&t&&t.contentPopOver&&zzb.types.isNonEmptyString(t.contentPopOver)&&t.$elem.popover({trigger:"hover",animation:!1,content:t.contentPopOver})};n.prototype.displayUIErrors=function(o,t){if((o=d.merge({selector:null,$form:null,selectorField:".zzb-form-field",attrFieldname:"zzb-fieldname",selectorError:".zzb-form-field-error",errs:null,err:null,hideWhenNoError:!1,typeFormats:{error:{glyph:"glyphicon-remove",textClass:"text-danger",bgClass:null},warning:{glyph:"glyphicon-warning",textClass:"text-warning",bgClass:null},success:{glyph:"glyphicon-ok",textClass:"text-success",bgClass:null},default:null},renderErrorHtml:i,afterHtmlAdded:s,handleSystemErrors:null},o)).renderErrorHtml){if(o.$form?o.selector=null:o.selector&&(o.$form=u("selector")),!o.$form||0===o.$form.length)return t&&t(!1);o.err&&!Array.isArray(o.err)?(o.errs=[zzb.rob.createError(o.err)],o.err=null):o.errs&&!Array.isArray(o.errs)&&(o.errs=[zzb.rob.createError(o.errs)],o.err=null);var a=zzb.rob.toObject(o.errs),l=!1;o.$form.find(o.selectorError).each(function(t,e){var r=u(e),n=r.closest(o.selectorField);if(0===n.length)return console.log("discovered an error field but could not determine the field to which it belongs (eg zzb-form-field)"),!0;var i=n.attr(o.attrFieldname);if(zzb.types.isEmptyString(i))return console.log('discovered an error field and its parent field (eg zzb-form-field) but the fieldname attribute is empty (eg zzb-fieldname="")'),!0;"_system"===i&&(l=!0);var s=o.renderErrorHtml(a[i],o);r.html(s.html),s.html&&zzb.types.isNonEmptyString(s.html)?r.removeClass("hidden"):r.addClass("hidden"),s.fieldname=i,s.$elem=r,o.afterHtmlAdded&&o.afterHtmlAdded(s)})}!l&&a._system&&0<a._system.length&&a._system[0]&&(o.handleSystemErrors?o.handleSystemErrors(a._system,o):zzb.dialogs.handleError({errs:a._system})),t&&t(!1)},r.forms=n},{}],4:[function(t,e,r){var o=window._,n=function(){};n.prototype.getPO=function(t,e){var r=t[e];return r||this.getPermObject(e+":")},n.prototype.getPermObjectFromPermkeys=function(t){var n={},i=this;return Array.isArray(t)?o.each(t,function(t){var e=i.getPermObject(t);e.key&&(n[e.key]=e)}):zzb.types.isObject(t)&&o.forOwn(t,function(t,e){t||(t="");var r=null;(r=t.indexOf(":")<0?i.getPermObject(e+":"+t):i.getPermObject(t))&&r.key&&(n[r.key]=r)}),n},n.prototype.mergePermkey=function(t,e){if(!e||!zzb.types.isNonEmptyString(e))return t;if(!t||!zzb.types.isNonEmptyString(t))return e;var r=null,n={},i={};if(t.indexOf(":")<=0?(n.key=t.trim(),n.perm=""):(r=t.split(":"),n.key=r[0].trim(),n.perm=r[1].trim().toUpperCase()),e.indexOf(":")<=0?(i.key=e.trim().toUpperCase(),i.perm=""):(r=e.split(":"),i.key=r[0].trim(),i.perm=r[1].trim().toUpperCase()),n.key!==i.key||n.perm===i.perm||0===i.perm.length)return t;if(0===n.key.length)return e;for(var s=0;s<i.perm.length;s++)n.perm.indexOf(i.perm[s])<0&&(n.perm+=i.perm[s]);return n.key+":"+n.perm},n.prototype.getPermObject=function(t,e,r){var n={key:null,perm:null,attr:{},toPermkey:function(){return this.key+":"+this.perm}};if((r||zzb.types.isNonEmptyString(r))&&(t=this.mergePermkey(t,r)),!t||!zzb.types.isNonEmptyString(t))return n.attr=this.getPermAttributes(),n;if(t.indexOf(":")<=0)return n.key=t,n.perm="",n.attr=this.getPermAttributes(),n;var i=t.split(":");if(n.key=i[0],n.perm=i[1],n.perm=n.perm.trim().toUpperCase(),0<n.perm.length&&e&&zzb.types.isNonEmptyString(e)){e=e.trim().toUpperCase();for(var s=n.perm.length-1;0<=s;s--)e.indexOf(n.perm[s])<0&&(n.perm=n.perm.replace(n.perm[s],""))}return n.attr=this.getPermAttributes(n.toPermkey(),e),n};var i=new RegExp("^[CRUDX]*$");n.prototype.getPermAttributes=function(t){var e={canRead:!1,canCreate:!1,canUpdate:!1,canDelete:!1,canExecute:!1};return t&&zzb.types.isNonEmptyString(t)?(0<=t.indexOf(":")&&(t=t.split(":")[1]),0===(t=t.trim().toUpperCase()).length||i.test(t)&&(e.canRead=0<=t.indexOf("C"),e.canCreate=0<=t.indexOf("R"),e.canUpdate=0<=t.indexOf("U"),e.canDelete=0<=t.indexOf("D"),e.canExecute=0<=t.indexOf("X")),e):e},n.prototype.hasMatch=function(t,e){if(!t||!e)return!1;var r=t;if(zzb.types.isNonEmptyString(t)&&(r=this.getPermObject(t)),!zzb.types.isObject(r)||!r.key||!r.perm||0===r.perm.length)return!1;var n=null;if(zzb.types.isNonEmptyString(e))n=this.getPermObject(e);else if(Array.isArray(e)){var i=this;o.each(e,function(t){if(zzb.types.isNonEmptyString(t)&&(t=i.getPermObject(t)),t.key===r.key)return n=t,!1})}else{if(!zzb.types.isObject(e))return!1;if(e.key)n=e;else{if(!e[r.key])return!1;n=zzb.types.isNonEmptyString(e[r.key])?this.getPermObject(r.key+":"+e[r.key]):e[r.key]}}if(!n||!n.key||!n.perm||0===!n.perm.length)return!1;for(var s=0;s<n.perm.length;s++)if(0<=r.perm.indexOf(n.perm[s]))return!0;return!1},r.perms=n},{}],5:[function(t,e,r){var l=window._,n=function(){};function i(t){if((t=l.merge({type:"error",message:null,field:"_system",stack:null,isErr:!0},t)).isErr)switch(t.type){case"warning":case"notice":case"info":case"debug":t.isErr=!1;break;default:t.isErr=!0}return t}n.prototype.newROB=function(t){return l.merge({errs:null,recs:[],fields:[],paginate:{page:0,limit:0,count:0},hasErrors:function(){return this.errs&&Array.isArray(this.errs)&&0<this.errs.length},hasFields:function(){return this.fields&&Array.isArray(this.fields)&&0<this.fields.length},hasRecords:function(){return this.recs&&Array.isArray(this.recs)&&0<this.recs.length},isEmpty:function(){return!this.hasRecords()||this.hasRecords()&&null===this.first()},first:function(){return this.recs&&Array.isArray(this.recs)&&0<this.recs.length?this.recs[0]:null},find:function(e,r){var n=null;return l.each(this.recs,function(t){if(t&&zzb.types.isObject(t)&&!Array.isArray(t)&&t[e]===r)return n=t,!1}),n},length:function(){return this.recs&&Array.isArray(this.recs)?this.recs.length:0}},t)},n.prototype.toObject=function(t){if(!t||!Array.isArray(t))return{_system:[t]};var e={};return l.each(t,function(t){t&&(t.field||(t.field="_system"),e[t.field]||(e[t.field]=[]),e[t.field].push(t))}),e};var s=function(t,e){if(!t)return i();if(zzb.types.isNonEmptyString(t))return i(l.merge({message:t},e));if(!Array.isArray(t)&&zzb.types.isObject(t))return i(t);throw new Error("bad input in createError - unrecognized err datatype")};n.prototype.createError=s,n.prototype.sanitizeErrors=function(t){var e=null;return t&&(Array.isArray(t)?0<t.length&&(e=[],l.each(t,function(t){e.push(s(t))})):e=[s(t)]),e},n.prototype.sanitizeRecords=function(t){return t?Array.isArray(t)?t:[t]:[]},n.prototype.toListErrs=function(t,n,i,e){var s=[],o=[];function a(t){return e?zzb.strings.format(e,t.message):"html"===n?zzb.strings.format("<li>{0}</li>",t.message):zzb.strings.format("System: {0}",t.message)}return n=n||"text",t&&Array.isArray(t)&&0<t.length&&l.each(t,function(t){var e,r;"_system"===t.system?o.push(a(t)):zzb.types.isNonEmptyString(t.field)?s.push((r=(e=t).title,e.title||(r=e.field),i?zzb.strings.format(i,r,e.message):"html"===n?zzb.strings.format("<li><strong>{0}</strong>: {1}</li>",r,e.message):zzb.strings.format("{0}: {1}",r,e.message))):o.push(a(t))}),{system:o,fields:s,hasSystemErrors:function(){return this.system&&0<this.system.length},hasFieldErrors:function(){return this.fields&&0<this.fields.length},combined:function(){return this.system.concat(this.fields)},hasErrors:function(){return this.hasSystemErrors()&&this.hasFieldErrors()}}},r.rob=n},{}],6:[function(t,e,r){var s=window.$,o=window._,n=function(){this.zzbStatus=null};n.prototype.get=function(t,e){var r=(t=o.merge({path:window.location.path,role:null})).path===window.location.path&&!t.role;if(r){if(this.zzbStatus)return e&&e(null,this.zzbStatus);var n=null;if("undefined"!=typeof Storage&&sessionStorage.zzbStatus){try{n=JSON.parse(sessionStorage.getItem("zzbStatus"))}catch(t){console.log("unable to parse zzbStatus from sessionStorage: "+t)}if(sessionStorage.setItem("zzbStatus",null),n)return this.zzbStatus=n,e&&e(null,this.zzbStatus)}if(0<s("#zzbStatus").length&&zzb.types.isNonEmptyString(s("#zzbStatus").attr("status"))){try{n=JSON.parse(s("#zzbStatus").attr("status"))}catch(t){console.log("unable to parse zzbStatus from embedded attribute in #zzbStatus: "+t)}if(n)return this.zzbStatus=n,e&&e(null,this.zzbStatus)}}n={user:{isLoggedIn:!1,username:null},page:{path:window.location.pathname}};var i=this;zzb.ajax.postJSON({url:"/zzb/status",data:t}).then(function(t){t.errs?e&&e(t.errs,n):(r&&(i.zzbStatus=t.one()),e&&e(null,t.one()))}).catch(function(t){console.log("failed to retrieve zzbStatus: using defaults"),e&&e(zzb.types.sanitizeErrors(t),n)})},r.status=n},{}],7:[function(t,e,r){var d,n=window._,i=function(){},p=function(t){var e=new Error(t);return e.name="ValueError",e};i.prototype.format=(d={},function(t){var a=Array.prototype.slice.call(arguments,1),l=0,u="UNDEFINED";return Array.isArray(a)&&0<a.length&&Array.isArray(a[0])&&(a=a[0].map(function(t){return t})),t.replace(/([{}])\1|[{](.*?)(?:!(.+?))?[}]/g,function(t,e,r,n){if(null!=e)return e;if(0<r.length){if("IMPLICIT"===u)throw p("cannot switch from implicit to explicit numbering");u="EXPLICIT"}else{if("EXPLICIT"===u)throw p("cannot switch from explicit to implicit numbering");u="IMPLICIT",r=String(l),l+=1}var i,s,o=(i="",null==(s=function(t,e){/^\d+$/.test(e[0])||(e=["0"].concat(e));for(var r=0;r<e.length;r+=1){var n=e[r];t="function"==typeof t[n]?t[n]():t[n]}return t}(a,r.split(".")))?i:s);if(null==n)return o;if(Object.prototype.hasOwnProperty.call(d,n))return d[n](o);throw p('no transformer named "'+n+'"')})}),i.prototype.formatEmpty=function(t){var r=Array.prototype.slice.call(arguments,1);return Array.isArray(r)?t.replace(/{(\d+)}/g,function(t,e){return void 0!==r[e]?r[e]:""}):t.replace(/{((?:(?=([^{}]+|{{[^}]*}}))\2)*)}/g,function(t,e){return 0<r.length&&r[0][e]?r[0][e]:""})},i.prototype.appendIfMoreThan=function(t,e,r){return t&&t.length>r?t.substring(0,r)+e:t},i.prototype.joinArrToCommas=function(n,i){return n&&Array.isArray(n)&&0!==n.length?n.map(n,function(t,e){var r="";return e<n.index-1&&(r=""),i?t[i]+r:t+r}).join(""):""},i.prototype.toPlural=function(t,e,r){return r=n.merge({forcePlural:!1,suffix:null},r),1!==e&&-1!==e||r.forcePlural?r.suffix?t+r.suffix:t+"s":t},r.strings=i},{}],8:[function(t,e,r){function n(){}n.prototype.escapeJqueryId=function(t,e){return(e=null==e?"#":e)+t.replace(/(:|\.|\[|\]|,)/g,"\\$1")},n.prototype.escapeHtml=function(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},n.prototype.isArray=function(t){return t&&void 0!==t&&"[object Array]"===Object.prototype.toString.call(t)},n.prototype.isArrayHasRecords=function(t){return this.isArray(t)&&0<t.length},n.prototype.isObject=function(t){return t&&"object"==typeof t},n.prototype.isNumber=function(t){return!isNaN(t-0)&&null!==t&&""!==t&&!1!==t},n.prototype.isNonEmptyString=function(t){return t&&"string"==typeof t&&0<t.trim().length},n.prototype.isEmptyString=function(t){return t&&"string"==typeof t&&0===t.trim().length},n.prototype.isString=function(t){return t&&"string"==typeof t},n.prototype.isFunction=function(t){return t&&"[object Function]"==={}.toString.call(t)},n.prototype.compare=function(t,e,r){return t===e?0:r?e<t?-1:1:e<t?1:-1},r.types=n},{}],9:[function(t,e,r){var n=window._,i=function(){};i.prototype.createPanelGroup=function(t){t=n.merge({id:zzb.uuid.newV4(),classPanelGroup:"",innerHtml:""},t);return zzb.strings.format('<div id="panelGroup_{id}" class="panel-group {classPanelGroup}">{innerHtml}</div>',t)},i.prototype.createPanelBody=function(t){t=n.merge({id:zzb.uuid.newV4(),classPanelBody:"",innerHtml:""},t);return zzb.strings.format('<div id="panelBody_{id}" class="panel-body {classPanelBody}">{innerHtml}</div>',t)},i.prototype.createPanel=function(t){t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",classPanelHeading:"",name:"",classPanelBody:"",innerHtml:""},t);var e='<div id="panel_{id}" class="panel panel-default {className}" {attributesExtra}><div class="panel-heading {classPanelHeading}>">{name}</div><div id="panelBody_{id}" class="panel-body {classPanelBody}">'+this.createPanelBody(t)+"</div></div>";return zzb.strings.format(e,t)},i.prototype.createPanelCollapsible=function(t){(t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",name:"",classPanelBody:"",innerHtml:"",isPanelCollapsed:!1,classNamePanelCollapsed:"",titleHtmlExtra:"",titleHtmlExtraRight:""},t)).isPanelCollapsed?(t._panelCollapsedClass1="collapsed",t._panelCollapsedClass2=""):(t._panelCollapsedClass1="",t._panelCollapsedClass2="in");var e='<div id="panel_{id}" class="panel panel-default {className}" {attributesExtra}><div class="panel-heading"><h4 class="panel-title">{titleHtmlExtra}<a data-toggle="collapse" data-target="#panelCollapse_{id}" href="#panelCollapse_{id}" class="{_panelCollapsedClass1}{classNamePanelCollapsed}">{name}</a> {titleHtmlExtraRight}</h4></div><div id="panelCollapse_{id}" class="panel-collapse collapse {_panelCollapsedClass2}">'+this.createPanelBody(t)+"</div></div>";return zzb.strings.format(e,t)},i.prototype.createPanelCollapsibleBegin=function(t){(t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",name:"",classPanelBody:"",innerHtml:"",isPanelCollapsed:!1,classNamePanelCollapsed:"",titleHtmlExtra:"",titleHtmlExtraRight:""},t)).isPanelCollapsed?(t._panelCollapsedClass1="collapsed",t._panelCollapsedClass2=""):(t._panelCollapsedClass1="",t._panelCollapsedClass2="in");return zzb.strings.format('<div class="panel panel-default {className}" id="panel_{id}" {attributesExtra}><div class="panel-heading"><h4 class="panel-title">{titleHtmlExtra}<a data-toggle="collapse" data-target="#panelCollapse_{id}" href="#panelCollapse_{id}" class="{_panelCollapsedClass1}{classNamePanelCollapsed}">{name}</a> {titleHtmlExtraRight}</h4></div><div id="panelCollapse_{id}" class="panel-collapse collapse {_panelCollapsedClass2}"><div class="panel-body" id="panelBody_{id}">',t)},i.prototype.createPanelCollapsibleEnd=function(){return"</div></div></div>"},r.uib=i},{}],10:[function(t,e,r){var n=window._,i=function(){};i.prototype.newV4=function(){var r=n.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(r+n.random(16))%16|0;return r=Math.floor(r/16),("x"===t?e:3&e|8).toString(16)})},i.prototype.isV4=function(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)},i.prototype.isValid=function(t){return/^([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}?)$/i.test(t)},r.uuid=i},{}],11:[function(t,e,r){var s=window._;function i(t,e,r,n){return new o(t,e,r,n)}function o(t,e,r,n){this.parent=t,this.data=e,this.pkField=r,this.parentField=n,this.nodeConstructor=i,this.nodeItemConstructor=i,this.isDirty=!1,this.data[r]||(this.data[r]=null),this.data[n]||(this.data[n]=null),this.parent?this.parent.getId()!==this.data[n]&&(this.data[n]=this.parent.getId(),this.isDirty=!0):this.parent=null,this.children=[],this.getData=function(){return this.data},this.getId=function(){return this.data[r]},this.getParent=function(){return this.parent},this.getRoot=function(){return null===this.parent?this:this.parent.getRoot()},this.removeChild=function(e){if(0<this.children.length){var t=s.findIndex(this.children,function(t){return t.getId()===e});-1<t&&this.children.splice(t,1)}},this.addChild=function(e,t,r){var n=this,i=s.find(this.children,function(t){return t.getId()===e[n.pkField]});return i||(i=this.nodeConstructor(this,e,t||this.pkField,r||this.parentField),this.children.push(i)),i},this.findChild=function(e,r){var n=null;return this.getId()===e?n=this:(r&&0<this.items.length&&s.each(this.items,function(t){if(t.getId()===e)return n=t,!1}),!n&&0<this.children.length&&s.each(this.children,function(t){if(n=t.findChild(e,r))return!1})),n},this.items=[],this.itemOwner=null,this.getItemOwner=function(){return this.itemOwner},this.addItem=function(e,t,r){var n=this,i=s.find(this.items,function(t){return t.getId()===e[n.pkField]});return i||((i=this.nodeItemConstructor(null,e,t,r)).itemOwner=this).items.push(i),i},this.removeItem=function(e){if(0<this.items.length){var t=s.findIndex(this.items,function(t){return t.getId()===e});-1<t&&this.items.splice(t,1)}},this.findItem=function(e){var r=null;return 0<this.items.length&&s.each(this.items,function(t){if(t.getId()===e)return r=t,!1}),!r&&0<this.children.length&&s.each(this.children,function(t){if(r=t.findItem(e))return!1}),r},this.sortChildren=function(e,t){e&&0<this.children.length&&(this.children.sort(e),t||s.each(this.children,function(t){t.sortChildren(e)}))},this.sortItems=function(t,e,r){t&&0<this.items.length&&(this.items.sort(t),e&&s.each(this.items,function(t){r||t.sortChildren(e,r)}))},this.getLevelDeep=function(){var t=0;return this.parent&&(t=1,t+=this.parent.getLevelDeep()),t},this.branchCallFunction=function(t,e,r){e||t&&t(this),this.parent&&this.parent.branchCallfunction(t,e,r),r&&this.itemOwner&&this.itemOwner.branchCallfunction(t,e,r),e&&t&&t(this)},this.branchCallFunctionChildren=function(e,r){e&&e(this),0<this.children.length&&s.each(this.children,function(t){t.branchCallFunctionChildren(e,r)}),r&&0<this.items.length&&s.each(this.items,function(t){t.branchCallFunctionChildren(e,r)})}}e.exports.zzNode=o},{}],12:[function(c,r,t){if("undefined"==typeof jQuery)throw new Error("zazzy-browser's JavaScript requires jQuery. jQuery must be included before zazzy-browser's JavaScript.");if("undefined"==typeof _)throw new Error("zazzy-browser's JavaScript requires lodash. lodash must be included before zazzy-browser's JavaScript.");!function(t,e){if("undefined"!=typeof window)window.zzb=e();else if(void 0!==t)t.zzb=e();else if("function"==typeof define&&define.amd)define(e);else{if("object"!=typeof r||!r.exports)throw new Error("could not locate global cache object in which to create zzb");r.exports=e()}}(this,function(){"use strict";var t=c("./zzNode.js"),e=c("./types.js").types,r=c("./uuid.js").uuid,n=c("./strings.js").strings,i=c("./uib.js").uib,s=c("./forms.js").forms,o=c("./dialogs.js").dialogs,a=c("./perms.js").perms,l=c("./rob.js").rob,u=c("./ajax.js").ajax,d=c("./status.js").status;function p(){}return p.prototype.zzNode=t,p.prototype.types=new e,p.prototype.uuid=new r,p.prototype.strings=new n,p.prototype.uib=new i,p.prototype.forms=new s,p.prototype.dialogs=new o,p.prototype.perms=new a,p.prototype.rob=new l,p.prototype.ajax=new u,p.prototype.status=new d,new p})},{"./ajax.js":1,"./dialogs.js":2,"./forms.js":3,"./perms.js":4,"./rob.js":5,"./status.js":6,"./strings.js":7,"./types.js":8,"./uib.js":9,"./uuid.js":10,"./zzNode.js":11}]},{},[12]); | ||
!function s(o,a,l){function u(e,t){if(!a[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(d)return d(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[e]={exports:{}};o[e][0].call(i.exports,function(t){return u(o[e][1][t]||t)},i,i.exports,s,o,a,l)}return a[e].exports}for(var d="function"==typeof require&&require,t=0;t<l.length;t++)u(l[t]);return u}({1:[function(t,e,r){var n=window.$;function i(){this.ajax=function(o){return new Promise(function(i,s){n.ajax(o).done(function(t,e,r){if(o.RAWRETURN)return i(t);if(!t)return s(new Error("Data returned is empty when at minimum a status is required"));var n=zzb.rob.newROB();if(r.responseJSON){if(t.redirect&&0<t.redirect.length)return void(window.location.href=t.redirect);t.ISROBERRORS||(t.err?(t.errs=zzb.rob.sanitizeErrors(t.err),t.err=null):t.error?(t.error=zzb.rob.sanitizeErrors(t.error),t.error=null):t.errs&&(t.errs=zzb.rob.sanitizeErrors(t.errs),t.err=null)),t.ISROBRECS||(t.recs?t.recs=zzb.rob.sanitizeRecords(t.recs):t.rec?(t.recs=zzb.rob.sanitizeRecords(t.rec),t.rec=null):t.recs=zzb.rob.sanitizeRecords(t)),t.paginate&&(n.paginate=t.paginate),n.errs=t.errs,n.recs=t.recs,n.fields=t.fields}else n.recs=[t];i(n)}).fail(function(t,e,r){s(r),console.log(r)})})}}i.prototype.get=function(t){return t.type="GET",t.contentType="application/json; charset=UTF-8",t.data=JSON.stringify(t.data),this.ajax(t)},i.prototype.getJSON=function(t){return t.type="GET",t.dataType="json",t.contentType="application/json; charset=UTF-8",t.data=JSON.stringify(t.data),this.ajax(t)},i.prototype.postJSON=function(t){return t.type="POST",t.dataType="json",t.contentType="application/json; charset=UTF-8",t.data=JSON.stringify(t.data),this.ajax(t)},r.ajax=i},{}],2:[function(t,e,r){var o=window._,a=function(t){this.defaultOptions=a.getDialogDefaults(t),this.defaultOptions.onShow="function"==typeof t.onShow?t.onShow:function(){},this.defaultOptions.onShown="function"==typeof t.onShown?t.onShown:function(){},this.defaultOptions.onHide="function"==typeof t.onHide?t.onHide:function(){},this.defaultOptions.onHidden="function"==typeof t.onHidden?t.onHidden:function(){}};a.getButtonDefaults=function(t){var e={id:null,type:a.TYPE_NONE,label:"",className:"",action:null,isDismiss:!1,isOutline:!1};return zzb.types.isObject(t)?o.merge(e,t):e},a.getDialogDefaults=function(t){var e={id:zzb.uuid.newV4(),type:a.TYPE_NONE,className:"",title:"",body:"",buttons:[],onShow:null,onShown:null,onHide:null,onHidden:null,doVerticalCenter:!0,doAutoDestroy:!0};return zzb.types.isObject(t)?o.merge(e,t):e},a.BUTTON_CLOSE="button-close",a.BUTTON_OK="button-ok",a.BUTTON_YES="button-yes",a.BUTTON_NO="button-no",a.BUTTON_CANCEL="button-cancel",a.TYPE_NONE="none",a.TYPE_PRIMARY="primary",a.TYPE_SECONDARY="secondary",a.TYPE_SUCCESS="success",a.TYPE_DANGER="danger",a.TYPE_WARNING="warning",a.TYPE_INFO="info",a.TYPE_LIGHT="light",a.TYPE_DARK="dark",a.TYPE_LINK="link",a.getButtonPreset=function(t,e,r){var n=a.getButtonDefaults();switch(n.isDismiss=!0,e===r-1?n.type=a.TYPE_PRIMARY:e===r-2&&(n.type=a.TYPE_SECONDARY),t){case"button-close":n.label="Close";break;case"button-ok":n.label="Ok";break;case"button-accept":n.label="Accept";break;case"button-yes":n.label="Yes";break;case"button-no":n.label="No";break;case"button-cancel":n.label="Cancel";break;default:n=null}return n},a.validateType=function(t){if(!t)return a.TYPE_NONE;switch(t){case a.TYPE_PRIMARY:case a.TYPE_SECONDARY:case a.TYPE_SUCCESS:case a.TYPE_DANGER:case a.TYPE_WARNING:case a.TYPE_INFO:case a.TYPE_LIGHT:case a.TYPE_DARK:case a.TYPE_LINK:return t;default:return a.TYPE_NONE}},a.isTypeNone=function(t){return a.validateType(t)===a.TYPE_NONE},a.prototype.getId=function(){return zzb.types.isNonEmptyString(this.defaultOptions.id)||(this.defaultOptions.id=zzb.uuid.newV4()),this.defaultOptions.id},a.prototype.getClassName=function(){return zzb.types.isNonEmptyString(this.defaultOptions.className)||(this.defaultOptions.className=""),this.defaultOptions.className},a.prototype.getTitle=function(){return zzb.types.isNonEmptyString(this.defaultOptions.title)||(this.defaultOptions.title=""),this.defaultOptions.title},a.prototype.getBody=function(){return zzb.types.isNonEmptyString(this.defaultOptions.body)||(this.defaultOptions.body=""),this.defaultOptions.body},a.prototype.create$Modal=function(){var t={id:this.getId(),arialabel:"arialabel"+this.getId(),className:this.getClassName(),title:this.getTitle(),body:this.getBody(),classVerticalCenter:this.defaultOptions.doVerticalCenter?" modal-dialog-centered":"",classModalHeader:""};a.isTypeNone(this.defaultOptions.type)||(t.classModalHeader+=" alert-"+this.defaultOptions.type);var n=$(zzb.strings.format('<div class="modal fade modal-fullscreen {cssClass}" id="{id}" tabindex="-1" role="dialog" aria-labelledby="{arialabel}" aria-hidden="true"><div class="modal-dialog{classVerticalCenter}" role="document"><div class="modal-content"><div class="modal-header{classModalHeader}"><h5 class="modal-title" id="{arialabel}">{title}</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body">{body}</div><div class="modal-footer"></div></div></div></div>',t));Array.isArray(this.defaultOptions.buttons)||(this.defaultOptions.buttons=[]);var i=this,s=this.defaultOptions.buttons.length;return o.each(this.defaultOptions.buttons,function(t,e){if(zzb.types.isNonEmptyString(t)&&(t=a.getButtonPreset(t,e,s)),zzb.types.isObject(t)){zzb.types.isNonEmptyString(t.id)||(t.id="button-"+e+"-"+i.getId()),t.isDismiss&&(zzb.types.isFunction(t.action)||(t.action=function(t,e){t.close()}),n.find(".modal-header button.close").attr("aria-label",t.label)),a.isTypeNone(t.type)||(t.isOutline?t.className+=" btn-outline-"+t.type:t.className+=" btn-"+t.type);var r=$(zzb.strings.format('<button id="{id}" type="button" class="btn {className}">{label}</button>',t));r.data("button",t),r.on("click",{dialog:i,$button:r,button:t},function(t){var e=t.data.dialog,r=t.data.$button,n=r.data("button");if("function"==typeof n.action)return n.action.call(r,e,t)}),0<n.find(".modal-footer > button").length?r.insertAfter(n.find(".modal-footer > button").last()):n.find(".modal-footer").append(r)}}),n},a.prototype.open=function(){if(!this.$modal){this.$modal=this.create$Modal();var e=this;this.$modal.on("show.bs.modal",function(t){e.onShow(t)}),this.$modal.on("shown.bs.modal",function(t){e.onShown(t)}),this.$modal.on("hide.bs.modal",function(t){e.onHide(t)}),this.$modal.on("hidden.bs.modal",function(t){e.onHidden(t)})}this.$modal.modal("show"),this.$modal.appendTo("body")},a.prototype.onShow=function(t){this.defaultOptions.onShow(t,this,this.$modal)},a.prototype.onShown=function(t){this.defaultOptions.onShown(t,this,this.$modal)},a.prototype.onHide=function(t){this.defaultOptions.onHide(t,this,this.$modal)},a.prototype.onHidden=function(t){this.defaultOptions.onHidden(t,this,this.$modal),this.defaultOptions.doAutoDestroy&&this.$modal.remove()},a.prototype.close=function(){this.$modal.modal("hide")},a.prototype.hide=function(){this.$modal.modal("hide"),this.$modal.modal("dispose"),0<$("#"+this.getId()).length&&$("#"+this.getId()).remove(),this.$modal=null};var n=function(){};n.prototype.ZazzyDialog=a,n.prototype.modal=function(t){return new a(t)},n.prototype.showMessage=function(t){zzb.dialogs.modal(o.merge({type:a.TYPE_NONE,buttons:[a.BUTTON_OK]},t)).open()},n.prototype.showMessageChoice=function(t){zzb.dialogs.modal(o.merge({type:a.TYPE_NONE,buttons:[a.BUTTON_CANCEL,a.getButtonDefaults({type:a.TYPE_PRIMARY,label:"Accept",action:function(t,e){t.close()}})]},t)).open()},n.prototype.handleError=function(t){if((t=o.merge({log:null,type:a.TYPE_DANGER,title:"",body:'<div class="zzb-dialog-errors">{errors}</div><div class="zzb-dialog-message">{message}</div>',message:"",errs:null,errors:"",buttons:[a.getButtonDefaults({type:a.TYPE_DANGER,label:"Ok",action:function(t,e){t.close()}})]},t)).log&&console.log(t.log),!zzb.types.isNonEmptyString(t.errors)&&zzb.types.isArray(t.errs)){var r=[];o.each(t.errs,function(t,e){t.message&&zzb.types.isNonEmptyString(t.message)&&r.push(zzb.strings.format('<div class="zzb-dialog-error-item">{0}</div>',t.message))}),t.errors=r.join("\n")}t.body=zzb.strings.format(t.body,t),this.showMessage(t)},r.dialogs=n},{}],3:[function(t,e,r){var u=window.$,d=window._,n=function(){},i=function(t,n){var i=[],s=[];if(!t||0===t.length||!t[0]){if(n.hideWhenNoError)return{html:null,contentPopOver:null};t=[{type:"success",message:null}]}return d.each(t,function(t,e){if(t.field||(t.field="_system"),"_system"===t.field)i.push(zzb.strings.format("<div>{0}</div>",t.message));else{var r=n.typeFormats.error;t.type&&n.typeFormats[t.type]&&(r=n.typeFormats[t.type]),0===e&&i.push(zzb.strings.format('<span class="glyphicon {0} {1}"></span>',r.glyph,r.textClass)),t.message&&zzb.types.isNonEmptyString(t.message)&&s.push(t.message)}}),{html:i.join(" "),contentPopOver:s.join(" ")}},s=function(t){t.$elem&&0<t.$elem.length&&t&&t.contentPopOver&&zzb.types.isNonEmptyString(t.contentPopOver)&&t.$elem.popover({trigger:"hover",animation:!1,content:t.contentPopOver})};n.prototype.displayUIErrors=function(o,t){if((o=d.merge({selector:null,$form:null,selectorField:".zzb-form-field",attrFieldname:"zzb-fieldname",selectorError:".zzb-form-field-error",errs:null,err:null,hideWhenNoError:!1,typeFormats:{error:{glyph:"glyphicon-remove",textClass:"text-danger",bgClass:null},warning:{glyph:"glyphicon-warning",textClass:"text-warning",bgClass:null},success:{glyph:"glyphicon-ok",textClass:"text-success",bgClass:null},default:null},renderErrorHtml:i,afterHtmlAdded:s,handleSystemErrors:null},o)).renderErrorHtml){if(o.$form?o.selector=null:o.selector&&(o.$form=u("selector")),!o.$form||0===o.$form.length)return t&&t(!1);o.err&&!Array.isArray(o.err)?(o.errs=[zzb.rob.createError(o.err)],o.err=null):o.errs&&!Array.isArray(o.errs)&&(o.errs=[zzb.rob.createError(o.errs)],o.err=null);var a=zzb.rob.toObject(o.errs),l=!1;o.$form.find(o.selectorError).each(function(t,e){var r=u(e),n=r.closest(o.selectorField);if(0===n.length)return console.log("discovered an error field but could not determine the field to which it belongs (eg zzb-form-field)"),!0;var i=n.attr(o.attrFieldname);if(zzb.types.isEmptyString(i))return console.log('discovered an error field and its parent field (eg zzb-form-field) but the fieldname attribute is empty (eg zzb-fieldname="")'),!0;"_system"===i&&(l=!0);var s=o.renderErrorHtml(a[i],o);r.html(s.html),s.html&&zzb.types.isNonEmptyString(s.html)?r.removeClass("hidden"):r.addClass("hidden"),s.fieldname=i,s.$elem=r,o.afterHtmlAdded&&o.afterHtmlAdded(s)})}!l&&a._system&&0<a._system.length&&a._system[0]&&(o.handleSystemErrors?o.handleSystemErrors(a._system,o):zzb.dialogs.handleError({errs:a._system})),t&&t(!1)},r.forms=n},{}],4:[function(t,e,r){var o=window._,n=function(){};n.prototype.getPO=function(t,e){var r=t[e];return r||this.getPermObject(e+":")},n.prototype.getPermObjectFromPermkeys=function(t){var n={},i=this;return Array.isArray(t)?o.each(t,function(t){var e=i.getPermObject(t);e.key&&(n[e.key]=e)}):zzb.types.isObject(t)&&o.forOwn(t,function(t,e){t||(t="");var r=null;(r=t.indexOf(":")<0?i.getPermObject(e+":"+t):i.getPermObject(t))&&r.key&&(n[r.key]=r)}),n},n.prototype.mergePermkey=function(t,e){if(!e||!zzb.types.isNonEmptyString(e))return t;if(!t||!zzb.types.isNonEmptyString(t))return e;var r=null,n={},i={};if(t.indexOf(":")<=0?(n.key=t.trim(),n.perm=""):(r=t.split(":"),n.key=r[0].trim(),n.perm=r[1].trim().toUpperCase()),e.indexOf(":")<=0?(i.key=e.trim().toUpperCase(),i.perm=""):(r=e.split(":"),i.key=r[0].trim(),i.perm=r[1].trim().toUpperCase()),n.key!==i.key||n.perm===i.perm||0===i.perm.length)return t;if(0===n.key.length)return e;for(var s=0;s<i.perm.length;s++)n.perm.indexOf(i.perm[s])<0&&(n.perm+=i.perm[s]);return n.key+":"+n.perm},n.prototype.getPermObject=function(t,e,r){var n={key:null,perm:null,attr:{},toPermkey:function(){return this.key+":"+this.perm}};if((r||zzb.types.isNonEmptyString(r))&&(t=this.mergePermkey(t,r)),!t||!zzb.types.isNonEmptyString(t))return n.attr=this.getPermAttributes(),n;if(t.indexOf(":")<=0)return n.key=t,n.perm="",n.attr=this.getPermAttributes(),n;var i=t.split(":");if(n.key=i[0],n.perm=i[1],n.perm=n.perm.trim().toUpperCase(),0<n.perm.length&&e&&zzb.types.isNonEmptyString(e)){e=e.trim().toUpperCase();for(var s=n.perm.length-1;0<=s;s--)e.indexOf(n.perm[s])<0&&(n.perm=n.perm.replace(n.perm[s],""))}return n.attr=this.getPermAttributes(n.toPermkey(),e),n};var i=new RegExp("^[CRUDX]*$");n.prototype.getPermAttributes=function(t){var e={canRead:!1,canCreate:!1,canUpdate:!1,canDelete:!1,canExecute:!1};return t&&zzb.types.isNonEmptyString(t)?(0<=t.indexOf(":")&&(t=t.split(":")[1]),0===(t=t.trim().toUpperCase()).length||i.test(t)&&(e.canRead=0<=t.indexOf("C"),e.canCreate=0<=t.indexOf("R"),e.canUpdate=0<=t.indexOf("U"),e.canDelete=0<=t.indexOf("D"),e.canExecute=0<=t.indexOf("X")),e):e},n.prototype.hasMatch=function(t,e){if(!t||!e)return!1;var r=t;if(zzb.types.isNonEmptyString(t)&&(r=this.getPermObject(t)),!zzb.types.isObject(r)||!r.key||!r.perm||0===r.perm.length)return!1;var n=null;if(zzb.types.isNonEmptyString(e))n=this.getPermObject(e);else if(Array.isArray(e)){var i=this;o.each(e,function(t){if(zzb.types.isNonEmptyString(t)&&(t=i.getPermObject(t)),t.key===r.key)return n=t,!1})}else{if(!zzb.types.isObject(e))return!1;if(e.key)n=e;else{if(!e[r.key])return!1;n=zzb.types.isNonEmptyString(e[r.key])?this.getPermObject(r.key+":"+e[r.key]):e[r.key]}}if(!n||!n.key||!n.perm||0===!n.perm.length)return!1;for(var s=0;s<n.perm.length;s++)if(0<=r.perm.indexOf(n.perm[s]))return!0;return!1},r.perms=n},{}],5:[function(t,e,r){var l=window._,n=function(){};function i(t){if((t=l.merge({type:"error",message:null,field:"_system",stack:null,isErr:!0},t)).isErr)switch(t.type){case"warning":case"notice":case"info":case"debug":t.isErr=!1;break;default:t.isErr=!0}return t}n.prototype.newROB=function(t){return l.merge({errs:null,recs:[],fields:[],paginate:{page:0,limit:0,count:0},hasErrors:function(){return this.errs&&Array.isArray(this.errs)&&0<this.errs.length},hasFields:function(){return this.fields&&Array.isArray(this.fields)&&0<this.fields.length},hasRecords:function(){return this.recs&&Array.isArray(this.recs)&&0<this.recs.length},isEmpty:function(){return!this.hasRecords()||this.hasRecords()&&null===this.first()},first:function(){return this.recs&&Array.isArray(this.recs)&&0<this.recs.length?this.recs[0]:null},find:function(e,r){var n=null;return l.each(this.recs,function(t){if(t&&zzb.types.isObject(t)&&!Array.isArray(t)&&t[e]===r)return n=t,!1}),n},length:function(){return this.recs&&Array.isArray(this.recs)?this.recs.length:0}},t)},n.prototype.toObject=function(t){if(!t||!Array.isArray(t))return{_system:[t]};var e={};return l.each(t,function(t){t&&(t.field||(t.field="_system"),e[t.field]||(e[t.field]=[]),e[t.field].push(t))}),e};var s=function(t,e){if(!t)return i();if(zzb.types.isNonEmptyString(t))return i(l.merge({message:t},e));if(!Array.isArray(t)&&zzb.types.isObject(t))return i(t);throw new Error("bad input in createError - unrecognized err datatype")};n.prototype.createError=s,n.prototype.sanitizeErrors=function(t){var e=null;return t&&(Array.isArray(t)?0<t.length&&(e=[],l.each(t,function(t){e.push(s(t))})):e=[s(t)]),e},n.prototype.sanitizeRecords=function(t){return t?Array.isArray(t)?t:[t]:[]},n.prototype.toListErrs=function(t,n,i,e){var s=[],o=[];function a(t){return e?zzb.strings.format(e,t.message):"html"===n?zzb.strings.format("<li>{0}</li>",t.message):zzb.strings.format("System: {0}",t.message)}return n=n||"text",t&&Array.isArray(t)&&0<t.length&&l.each(t,function(t){var e,r;"_system"===t.system?o.push(a(t)):zzb.types.isNonEmptyString(t.field)?s.push((r=(e=t).title,e.title||(r=e.field),i?zzb.strings.format(i,r,e.message):"html"===n?zzb.strings.format("<li><strong>{0}</strong>: {1}</li>",r,e.message):zzb.strings.format("{0}: {1}",r,e.message))):o.push(a(t))}),{system:o,fields:s,hasSystemErrors:function(){return this.system&&0<this.system.length},hasFieldErrors:function(){return this.fields&&0<this.fields.length},combined:function(){return this.system.concat(this.fields)},hasErrors:function(){return this.hasSystemErrors()&&this.hasFieldErrors()}}},r.rob=n},{}],6:[function(t,e,r){var s=window.$,o=window._,n=function(){this.zzbStatus=null};n.prototype.get=function(t,e){var r=(t=o.merge({path:window.location.path,role:null})).path===window.location.path&&!t.role;if(r){if(this.zzbStatus)return e&&e(null,this.zzbStatus);var n=null;if("undefined"!=typeof Storage&&sessionStorage.zzbStatus){try{n=JSON.parse(sessionStorage.getItem("zzbStatus"))}catch(t){console.log("unable to parse zzbStatus from sessionStorage: "+t)}if(sessionStorage.setItem("zzbStatus",null),n)return this.zzbStatus=n,e&&e(null,this.zzbStatus)}if(0<s("#zzbStatus").length&&zzb.types.isNonEmptyString(s("#zzbStatus").attr("status"))){try{n=JSON.parse(s("#zzbStatus").attr("status"))}catch(t){console.log("unable to parse zzbStatus from embedded attribute in #zzbStatus: "+t)}if(n)return this.zzbStatus=n,e&&e(null,this.zzbStatus)}}n={user:{isLoggedIn:!1,username:null},page:{path:window.location.pathname}};var i=this;zzb.ajax.postJSON({url:"/zzb/status",data:t}).then(function(t){t.errs?e&&e(t.errs,n):(r&&(i.zzbStatus=t.one()),e&&e(null,t.one()))}).catch(function(t){console.log("failed to retrieve zzbStatus: using defaults"),e&&e(zzb.types.sanitizeErrors(t),n)})},r.status=n},{}],7:[function(t,e,r){var n=window._,i=function(){};function d(t){var e=new Error(t);return e.name="ValueError",e}var c;i.prototype.format=(c={},function(t){var a=Array.prototype.slice.call(arguments,1),l=0,u="UNDEFINED";return Array.isArray(a)&&0<a.length&&Array.isArray(a[0])&&(a=a[0].map(function(t){return t})),t.replace(/([{}])\1|[{](.*?)(?:!(.+?))?[}]/g,function(t,e,r,n){if(null!=e)return e;var i=r;if(0<i.length){if("IMPLICIT"===u)throw d("cannot switch from implicit to explicit numbering");u="EXPLICIT"}else{if("EXPLICIT"===u)throw d("cannot switch from explicit to implicit numbering");u="IMPLICIT",i=String(l),l+=1}var s=i.split("."),o=(/^\d+$/.test(s[0])?s:["0"].concat(s)).reduce(function(t,r){return t.reduce(function(t,e){return null!=e&&r in Object(e)?["function"==typeof e[r]?e[r]():e[r]]:[]},[])},[a]).reduce(function(t,e){return e},"");if(null==n)return o;if(Object.prototype.hasOwnProperty.call(c,n))return c[n](o);throw d('no transformer named "'+n+'"')})}),i.prototype.formatEmpty=function(t){var r=Array.prototype.slice.call(arguments,1);return Array.isArray(r)?t.replace(/{(\d+)}/g,function(t,e){return void 0!==r[e]?r[e]:""}):t.replace(/{((?:(?=([^{}]+|{{[^}]*}}))\2)*)}/g,function(t,e){return 0<r.length&&r[0][e]?r[0][e]:""})},i.prototype.appendIfMoreThan=function(t,e,r){return t&&t.length>r?t.substring(0,r)+e:t},i.prototype.joinArrToCommas=function(n,i){return n&&Array.isArray(n)&&0!==n.length?n.map(n,function(t,e){var r="";return e<n.index-1&&(r=""),i?t[i]+r:t+r}).join(""):""},i.prototype.toPlural=function(t,e,r){return r=n.merge({forcePlural:!1,suffix:null},r),1!==e&&-1!==e||r.forcePlural?r.suffix?t+r.suffix:t+"s":t},r.strings=i},{}],8:[function(t,e,r){function n(){}n.prototype.escapeJqueryId=function(t,e){return(e=null==e?"#":e)+t.replace(/(:|\.|\[|\]|,)/g,"\\$1")},n.prototype.escapeHtml=function(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},n.prototype.isArray=function(t){return t&&void 0!==t&&"[object Array]"===Object.prototype.toString.call(t)},n.prototype.isArrayHasRecords=function(t){return this.isArray(t)&&0<t.length},n.prototype.isObject=function(t){return t&&"object"==typeof t},n.prototype.isNumber=function(t){return!isNaN(t-0)&&null!==t&&""!==t&&!1!==t},n.prototype.isNonEmptyString=function(t){return t&&"string"==typeof t&&0<t.trim().length},n.prototype.isEmptyString=function(t){return t&&"string"==typeof t&&0===t.trim().length},n.prototype.isString=function(t){return t&&"string"==typeof t},n.prototype.isFunction=function(t){return t&&"[object Function]"==={}.toString.call(t)},n.prototype.compare=function(t,e,r){return t===e?0:r?e<t?-1:1:e<t?1:-1},r.types=n},{}],9:[function(t,e,r){var n=window._,i=function(){};i.prototype.createPanelGroup=function(t){t=n.merge({id:zzb.uuid.newV4(),classPanelGroup:"",innerHtml:""},t);return zzb.strings.format('<div id="panelGroup_{id}" class="panel-group {classPanelGroup}">{innerHtml}</div>',t)},i.prototype.createPanelBody=function(t){t=n.merge({id:zzb.uuid.newV4(),classPanelBody:"",innerHtml:""},t);return zzb.strings.format('<div id="panelBody_{id}" class="panel-body {classPanelBody}">{innerHtml}</div>',t)},i.prototype.createPanel=function(t){t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",classPanelHeading:"",name:"",classPanelBody:"",innerHtml:""},t);var e='<div id="panel_{id}" class="panel panel-default {className}" {attributesExtra}><div class="panel-heading {classPanelHeading}>">{name}</div><div id="panelBody_{id}" class="panel-body {classPanelBody}">'+this.createPanelBody(t)+"</div></div>";return zzb.strings.format(e,t)},i.prototype.createPanelCollapsible=function(t){(t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",name:"",classPanelBody:"",innerHtml:"",isPanelCollapsed:!1,classNamePanelCollapsed:"",titleHtmlExtra:"",titleHtmlExtraRight:""},t)).isPanelCollapsed?(t._panelCollapsedClass1="collapsed",t._panelCollapsedClass2=""):(t._panelCollapsedClass1="",t._panelCollapsedClass2="in");var e='<div id="panel_{id}" class="panel panel-default {className}" {attributesExtra}><div class="panel-heading"><h4 class="panel-title">{titleHtmlExtra}<a data-toggle="collapse" data-target="#panelCollapse_{id}" href="#panelCollapse_{id}" class="{_panelCollapsedClass1}{classNamePanelCollapsed}">{name}</a> {titleHtmlExtraRight}</h4></div><div id="panelCollapse_{id}" class="panel-collapse collapse {_panelCollapsedClass2}">'+this.createPanelBody(t)+"</div></div>";return zzb.strings.format(e,t)},i.prototype.createPanelCollapsibleBegin=function(t){(t=n.merge({id:zzb.uuid.newV4(),className:"",attributesExtra:"",name:"",classPanelBody:"",innerHtml:"",isPanelCollapsed:!1,classNamePanelCollapsed:"",titleHtmlExtra:"",titleHtmlExtraRight:""},t)).isPanelCollapsed?(t._panelCollapsedClass1="collapsed",t._panelCollapsedClass2=""):(t._panelCollapsedClass1="",t._panelCollapsedClass2="in");return zzb.strings.format('<div class="panel panel-default {className}" id="panel_{id}" {attributesExtra}><div class="panel-heading"><h4 class="panel-title">{titleHtmlExtra}<a data-toggle="collapse" data-target="#panelCollapse_{id}" href="#panelCollapse_{id}" class="{_panelCollapsedClass1}{classNamePanelCollapsed}">{name}</a> {titleHtmlExtraRight}</h4></div><div id="panelCollapse_{id}" class="panel-collapse collapse {_panelCollapsedClass2}"><div class="panel-body" id="panelBody_{id}">',t)},i.prototype.createPanelCollapsibleEnd=function(){return"</div></div></div>"},r.uib=i},{}],10:[function(t,e,r){var n=window._,i=function(){};i.prototype.newV4=function(){var r=n.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(r+n.random(16))%16|0;return r=Math.floor(r/16),("x"===t?e:3&e|8).toString(16)})},i.prototype.isV4=function(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)},i.prototype.isValid=function(t){return/^([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}?)$/i.test(t)},r.uuid=i},{}],11:[function(t,e,r){var s=window._;function i(t,e,r,n){return new o(t,e,r,n)}function o(t,e,r,n){this.parent=t,this.data=e,this.pkField=r,this.parentField=n,this.nodeConstructor=i,this.nodeItemConstructor=i,this.isDirty=!1,this.data[r]||(this.data[r]=null),this.data[n]||(this.data[n]=null),this.parent?this.parent.getId()!==this.data[n]&&(this.data[n]=this.parent.getId(),this.isDirty=!0):this.parent=null,this.children=[],this.getData=function(){return this.data},this.getId=function(){return this.data[r]},this.getParent=function(){return this.parent},this.getRoot=function(){return null===this.parent?this:this.parent.getRoot()},this.removeChild=function(e){if(0<this.children.length){var t=s.findIndex(this.children,function(t){return t.getId()===e});-1<t&&this.children.splice(t,1)}},this.addChild=function(e,t,r){var n=this,i=s.find(this.children,function(t){return t.getId()===e[n.pkField]});return i||(i=this.nodeConstructor(this,e,t||this.pkField,r||this.parentField),this.children.push(i)),i},this.findChild=function(e,r){var n=null;return this.getId()===e?n=this:(r&&0<this.items.length&&s.each(this.items,function(t){if(t.getId()===e)return n=t,!1}),!n&&0<this.children.length&&s.each(this.children,function(t){if(n=t.findChild(e,r))return!1})),n},this.items=[],this.itemOwner=null,this.getItemOwner=function(){return this.itemOwner},this.addItem=function(e,t,r){var n=this,i=s.find(this.items,function(t){return t.getId()===e[n.pkField]});return i||((i=this.nodeItemConstructor(null,e,t,r)).itemOwner=this).items.push(i),i},this.removeItem=function(e){if(0<this.items.length){var t=s.findIndex(this.items,function(t){return t.getId()===e});-1<t&&this.items.splice(t,1)}},this.findItem=function(e){var r=null;return 0<this.items.length&&s.each(this.items,function(t){if(t.getId()===e)return r=t,!1}),!r&&0<this.children.length&&s.each(this.children,function(t){if(r=t.findItem(e))return!1}),r},this.sortChildren=function(e,t){e&&0<this.children.length&&(this.children.sort(e),t||s.each(this.children,function(t){t.sortChildren(e)}))},this.sortItems=function(t,e,r){t&&0<this.items.length&&(this.items.sort(t),e&&s.each(this.items,function(t){r||t.sortChildren(e,r)}))},this.getLevelDeep=function(){var t=0;return this.parent&&(t=1,t+=this.parent.getLevelDeep()),t},this.branchCallFunction=function(t,e,r){e||t&&t(this),this.parent&&this.parent.branchCallfunction(t,e,r),r&&this.itemOwner&&this.itemOwner.branchCallfunction(t,e,r),e&&t&&t(this)},this.branchCallFunctionChildren=function(e,r){e&&e(this),0<this.children.length&&s.each(this.children,function(t){t.branchCallFunctionChildren(e,r)}),r&&0<this.items.length&&s.each(this.items,function(t){t.branchCallFunctionChildren(e,r)})}}e.exports.zzNode=o},{}],12:[function(p,r,t){if("undefined"==typeof jQuery)throw new Error("zazzy-browser's JavaScript requires jQuery. jQuery must be included before zazzy-browser's JavaScript.");if("undefined"==typeof _)throw new Error("zazzy-browser's JavaScript requires lodash. lodash must be included before zazzy-browser's JavaScript.");!function(t,e){if("undefined"!=typeof window)window.zzb=e();else if(void 0!==t)t.zzb=e();else if("function"==typeof define&&define.amd)define(e);else{if("object"!=typeof r||!r.exports)throw new Error("could not locate global cache object in which to create zzb");r.exports=e()}}(this,function(){"use strict";var t=p("./zzNode.js"),e=p("./types.js").types,r=p("./uuid.js").uuid,n=p("./strings.js").strings,i=p("./uib.js").uib,s=p("./forms.js").forms,o=p("./dialogs.js").dialogs,a=p("./perms.js").perms,l=p("./rob.js").rob,u=p("./ajax.js").ajax,d=p("./status.js").status;function c(){}return c.prototype.zzNode=t,c.prototype.types=new e,c.prototype.uuid=new r,c.prototype.strings=new n,c.prototype.uib=new i,c.prototype.forms=new s,c.prototype.dialogs=new o,c.prototype.perms=new a,c.prototype.rob=new l,c.prototype.ajax=new u,c.prototype.status=new d,new c})},{"./ajax.js":1,"./dialogs.js":2,"./forms.js":3,"./perms.js":4,"./rob.js":5,"./status.js":6,"./strings.js":7,"./types.js":8,"./uib.js":9,"./uuid.js":10,"./zzNode.js":11}]},{},[12]); |
{ | ||
"name": "zazzy-browser", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "A collection of general-purpose browser utilities used as higher-level building-blocks to create Bootstrap v4 websites and assist in client-server communications.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -10,4 +10,3 @@ // client or server | ||
// ValueError :: String -> Error | ||
var formatValueError = function (message) { | ||
function ValueError (message) { | ||
var err = new Error(message) | ||
@@ -18,18 +17,2 @@ err.name = 'ValueError' | ||
// defaultTo :: a,a? -> a | ||
var formatDefaultTo = function (x, y) { | ||
return y == null ? x : y | ||
} | ||
var formatLookup = function (obj, path) { | ||
if (!/^\d+$/.test(path[0])) { | ||
path = ['0'].concat(path) | ||
} | ||
for (var idx = 0; idx < path.length; idx += 1) { | ||
var key = path[idx] | ||
obj = typeof obj[key] === 'function' ? obj[key]() : obj[key] | ||
} | ||
return obj | ||
} | ||
// https://github.com/davidchambers/string-format | ||
@@ -55,9 +38,10 @@ // create :: Object -> String,*... -> String | ||
/([{}])\1|[{](.*?)(?:!(.+?))?[}]/g, | ||
function (match, literal, key, xf) { | ||
function (match, literal, _key, xf) { | ||
if (literal != null) { | ||
return literal | ||
} | ||
var key = _key | ||
if (key.length > 0) { | ||
if (state === 'IMPLICIT') { | ||
throw formatValueError('cannot switch from ' + | ||
throw ValueError('cannot switch from ' + | ||
'implicit to explicit numbering') | ||
@@ -68,3 +52,3 @@ } | ||
if (state === 'EXPLICIT') { | ||
throw formatValueError('cannot switch from ' + | ||
throw ValueError('cannot switch from ' + | ||
'explicit to implicit numbering') | ||
@@ -76,4 +60,18 @@ } | ||
} | ||
var value = formatDefaultTo('', formatLookup(args, key.split('.'))) | ||
// 1. Split the key into a lookup path. | ||
// 2. If the first path component is not an index, prepend '0'. | ||
// 3. Reduce the lookup path to a single result. If the lookup | ||
// succeeds the result is a singleton array containing the | ||
// value at the lookup path; otherwise the result is []. | ||
// 4. Unwrap the result by reducing with '' as the default value. | ||
var path = key.split('.') | ||
var value = (/^\d+$/.test(path[0]) ? path : ['0'].concat(path)) | ||
.reduce(function (maybe, key) { | ||
return maybe.reduce(function (_, x) { | ||
return x != null && key in Object(x) ? [typeof x[key] === 'function' ? x[key]() : x[key]] : [] | ||
}, []) | ||
}, [args]) | ||
.reduce(function (_, x) { return x }, '') | ||
if (xf == null) { | ||
@@ -84,3 +82,3 @@ return value | ||
} else { | ||
throw formatValueError('no transformer named "' + xf + '"') | ||
throw ValueError('no transformer named "' + xf + '"') | ||
} | ||
@@ -87,0 +85,0 @@ } |
@@ -41,3 +41,3 @@ /* global describe, it */ | ||
if (compare !== sPig2) { | ||
err = new Error('failed matcy from strings') | ||
err = new Error('failed match from strings') | ||
} | ||
@@ -50,3 +50,3 @@ done(err) | ||
if (compare !== sPig2) { | ||
err = new Error('failed matcy from strings') | ||
err = new Error('failed match from strings') | ||
} | ||
@@ -59,3 +59,3 @@ done(err) | ||
if (compare !== sPig2) { | ||
err = new Error('failed matcy from strings') | ||
err = new Error('failed match from strings') | ||
} | ||
@@ -62,0 +62,0 @@ done(err) |
204786
4302