UNPKG

toloframework

Version:

Javascript/HTML/CSS compiler for Firefox OS or nodewebkit apps using modules in the nodejs style.

2 lines 1.84 kB
require("tfw.binding.converters",function(r,n,t){function e(r){if("number"==typeof r)return r+"px";if("auto"===(r=(""+r).trim().toLowerCase())||"inherit"===r)return r;var n=h.exec(r);if(!n)return"0";var t=parseFloat(n[1]);if(isNaN(t))return"0";var e=n[2];return e.length<1&&(e="px"),t+e}function u(r){return Array.isArray(r)?r.map(e):[]}function i(r){switch(typeof r){case"string":return"true"===r.trim().toLowerCase();case"number":return 0!==r;default:return!!r}}function o(r){return Array.isArray(r)?r.map(i):[]}function a(r){return!i(r)}function f(r){return v.isList(r)?r.slice():Array.isArray(r)?r:[r]}function s(r){return r&&"number"==typeof r.length?r.length:0}function c(r){return!r||("string"==typeof r?0===r.trim().length:"number"==typeof r.length&&0===r.length)}function l(r){return Array.isArray(r)?r.map(function(r){return""+r}):[]}function p(r){if(!Array.isArray(r)&&"object"!=typeof r){var n={};return n[g.lang()]=""+r,n}return r}function y(r){return v.isList(r)?r:new v(f(r))}var m=function(){function n(){return e(t,arguments)}var t={en:{},fr:{}},e=r("$").intl;return n.all=t,n}(),g=r("$"),v=r("tfw.binding.list"),b={boolean:i,booleans:o,multilang:p,not:a,strings:l,string:function(r){return""+r},integer:function(r){return"number"==typeof r?function(n){var t=parseInt(n);return isNaN(t)?r:t}:parseInt},float:function(r){return"number"==typeof r?function(n){var t=parseFloat(n);return isNaN(t)?r:t}:parseFloat},enum:function(r){var n=r.map(function(r){return r.toLowerCase()});return function(t){var e=Math.max(0,n.indexOf((""+t).toLowerCase()));return r[e]}},array:f,list:y,unit:e,units:u,length:s,isEmpty:c,isNotEmpty:c};t.get=function(r){return b[r]},t.set=function(r,n){"function"==typeof n?b[r]=n:delete b[r]};var h=/^(-?[.0-9]+)[ \n\r]*([a-z%]*)/;n.exports._=m}); //# sourceMappingURL=tfw.binding.converters.js.map