Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fenix-ui-converter

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fenix-ui-converter - npm Package Compare versions

Comparing version 1.0.0-beta.10 to 1.0.0-beta.11

2

dist/fenix-ui-converter.min.js

@@ -1,2 +0,2 @@

define(["jquery","underscore","loglevel","handlebars"],function(e,t,r,o){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var o,n;o=[r(2),r(3),r(4),r(5)],n=function(e,t,r,o){"use strict";function n(){return this}return n.prototype.toD3P=function(o,n){var i={},u=this;return t.each(n.values,function(t,n){var a=u.cleanArray(t),c=o[n]||{},s=c.format||{},l=s.dimension||n;a.length>0?i[l]=e.extend(!0,{},u.compileFilter(n,a,o)):r.warn(n+" column excluded from FENIX conversion because it has no values")}),i},n.prototype.toFilter=function(o,n){var i={},u=this;return t.each(n.values,function(t,n){var a=u.cleanArray(t),c=o[n]||{},s=c.format||{},l=s.metadataAttribute;return l?void(a.length>0?i[l]=e.extend(!0,{},u.compileFilter(n,a,o)):r.warn(n+" column excluded from FENIX filter because it has no values")):void r.warn(n+" impossible to find format.metadataAttribute configuration")}),i},n.prototype.compileFilter=function(e,t,o){var n=o[e]||{},i=n.format||{},u=i.template,a=i.output||"codes";if(u)return this.compileTemplate(e,t,n,u);var c,s=i.dimension||e;switch(a.toLocaleLowerCase()){case"freetext":return this.createFreeTextFilter(e,t,n,s);case"codes":return c='{ "codes":[{"uid": "{{{uid}}}", "version": "{{version}}", "codes": [{{{codes}}}] } ]}',this.compileTemplate(e,t,n,s,c);case"time":return this.createTimeFilter(e,t,n,s);case"number":return this.createNumberFilter(e,t,n,s);case"enumeration":return this.createEnumerationFilter(e,t,n,s);default:return r.warn(e+" not included in the result set. Missing format configuration."),{}}},n.prototype.compileTemplate=function(n,i,u,a,c){var s=e.extend(!0,u.cl,u.format,{codes:'"'+i.join('","')+'"'});if(c||r.error("Impossible to find '"+n+"' process template. Check your '"+n+"'.filter.process configuration."),!s.uid)return void r.error("Impossible to find '"+n+"' code list configuration for FENIX output format export.");var l=o.compile(c),f=JSON.parse(l(s)),p=f.codes;return t.each(p,function(e){e.version||delete e.version}),f},n.prototype.createNumberFilter=function(r,o,n,i){var u,a=[],c="object"==typeof o[0];if(c){var s=t.findWhere(o,{parent:"from"})||{},l=t.findWhere(o,{parent:"to"})||{},f={from:null,to:null};f.from=s.value,f.to=l.value,a.push(e.extend({},f))}else u=o.map(function(e){return parseInt(e,10)}).sort(function(e,t){return e-t}),t.each(u,function(e){a.push({from:e,to:e})});return{number:a}},n.prototype.createTimeFilter=function(r,o,n,i){var u,a=[],c="object"==typeof o[0];if(c){var s=t.findWhere(o,{parent:"from"})||{},l=t.findWhere(o,{parent:"to"})||{},f={from:null,to:null};f.from=s.value,f.to=l.value,a.push(e.extend({},f))}else u=o.map(function(e){return parseInt(e,10)}).sort(function(e,t){return e-t}),t.each(u,function(e){a.push({from:e,to:e})});return{time:a}},n.prototype.createEnumerationFilter=function(e,t,r,o){return{enumeration:t}},n.prototype.createFreeTextFilter=function(e,t,r,o){return{text:t[0]}},n.prototype.cleanArray=function(e){for(var t=[],r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t},new n}.apply(t,o),!(void 0!==n&&(e.exports=n))},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=o}])});
define(["jquery","underscore","loglevel","handlebars"],function(e,t,r,n){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var n,o;n=[r(2),r(3),r(4),r(5)],o=function(e,t,r,n){"use strict";function o(){return this}return o.prototype.toD3P=function(n,o){var i={},u=this;return t.each(o.values,function(t,o){var a=u.cleanArray(t),c=n[o]||{},s=c.format||{},l=s.dimension||o;a.length>0?i[l]=e.extend(!0,{},u.compileFilter(o,a,n)):r.warn(o+" column excluded from FENIX conversion because it has no values")}),i},o.prototype.toFilter=function(n,o){var i={},u=this;return t.each(o.values,function(t,o){var a=u.cleanArray(t),c=n[o]||{},s=c.format||{},l=s.metadataAttribute;return l?void(a.length>0?i[l]=e.extend(!0,{},u.compileFilter(o,a,n)):r.warn(o+" column excluded from FENIX filter because it has no values")):void r.warn(o+" impossible to find format.metadataAttribute configuration")}),i},o.prototype.compileFilter=function(e,t,n){var o=n[e]||{},i=o.format||{},u=i.template,a=i.output||"codes";if(u)return this.compileTemplate(e,t,o,u);var c,s=i.dimension||e;switch(a.toLocaleLowerCase()){case"freetext":return this.createFreeTextFilter(e,t,o,s);case"codes":return c='{ "codes":[{"uid": "{{{uid}}}", "version": "{{version}}", "codes": [{{{codes}}}] } ]}',this.compileTemplate(e,t,o,s,c);case"time":return this.createTimeFilter(e,t,o,s);case"number":return this.createNumberFilter(e,t,o,s);case"enumeration":return this.createEnumerationFilter(e,t,o,s);default:return r.warn(e+" not included in the result set. Missing format configuration."),{}}},o.prototype.compileTemplate=function(o,i,u,a,c){var s=e.extend(!0,u.cl);if(s=e.extend(!0,s,u.format,{codes:'"'+i.join('","')+'"'}),c||r.error("Impossible to find '"+o+"' process template. Check your '"+o+"'.filter.process configuration."),!s.uid)return void r.error("Impossible to find '"+o+"' code list configuration for FENIX output format export.");var l=n.compile(c),f=JSON.parse(l(s)),p=f.codes;return t.each(p,function(e){e.version||delete e.version}),f},o.prototype.createNumberFilter=function(r,n,o,i){var u,a=[],c="object"==typeof n[0];if(c){var s=t.findWhere(n,{parent:"from"})||{},l=t.findWhere(n,{parent:"to"})||{},f={from:null,to:null};f.from=s.value,f.to=l.value,a.push(e.extend({},f))}else u=n.map(function(e){return parseInt(e,10)}).sort(function(e,t){return e-t}),t.each(u,function(e){a.push({from:e,to:e})});return{number:a}},o.prototype.createTimeFilter=function(r,n,o,i){var u,a=[],c="object"==typeof n[0];if(c){var s=t.findWhere(n,{parent:"from"})||{},l=t.findWhere(n,{parent:"to"})||{},f={from:null,to:null};f.from=s.value,f.to=l.value,a.push(e.extend({},f))}else u=n.map(function(e){return parseInt(e,10)}).sort(function(e,t){return e-t}),t.each(u,function(e){a.push({from:e,to:e})});return{time:a}},o.prototype.createEnumerationFilter=function(e,t,r,n){return{enumeration:t}},o.prototype.createFreeTextFilter=function(e,t,r,n){return{text:t[0]}},o.prototype.cleanArray=function(e){for(var t=[],r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t},new o}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n}])});
//# sourceMappingURL=fenix-ui-converter.min.js.map
{
"name": "fenix-ui-converter",
"version": "1.0.0-beta.10",
"version": "1.0.0-beta.11",
"description": "FENIX ui converter",

@@ -12,5 +12,5 @@ "main": "dist/fenix-ui-converter.min.js",

"test": "mocha test/specs.js -w",
"dev": "NODE_ENV=develop webpack-dev-server --display-error-details --progress --color --content-base dev --inline --hot",
"build:production": "NODE_ENV=production webpack",
"build": "NODE_ENV=production webpack --display-error-details --profile --json > stats.json"
"dev": "cross-env NODE_ENV=develop webpack-dev-server --display-error-details --progress --color --content-base dev --inline --hot",
"build:production": "cross-env NODE_ENV=production webpack",
"build": "cross-env NODE_ENV=production webpack --display-error-details --profile --json > stats.json"
},

@@ -41,2 +41,3 @@ "repository": {

"clean-webpack-plugin": "0.1.10",
"cross-env": "^3.1.3",
"css-loader": "^0.25.0",

@@ -43,0 +44,0 @@ "extract-text-webpack-plugin": "^1.0.1",

@@ -126,3 +126,4 @@ if (typeof define !== 'function') {

var model = $.extend(true, config.cl, config.format, {codes: '"' + values.join('","') + '"'});
var model = $.extend(true, config.cl);
model = $.extend(true, model, config.format, {codes: '"' + values.join('","') + '"'});

@@ -129,0 +130,0 @@ if (!template) {

@@ -5,4 +5,4 @@ {

"version": "1.13.2",
"hash": "a0169510e2bf3596dc21",
"time": 258,
"hash": "013ca14bca0d69c4a833",
"time": 266,
"publicPath": "",

@@ -18,3 +18,3 @@ "assetsByChunkName": {

"name": "fenix-ui-converter.min.js",
"size": 3409,
"size": 3426,
"chunks": [

@@ -30,3 +30,3 @@ 0

"name": "fenix-ui-converter.min.js.map",
"size": 23451,
"size": 23564,
"chunks": [

@@ -48,3 +48,3 @@ 0

"extraAsync": false,
"size": 6572,
"size": 6611,
"names": [

@@ -57,3 +57,3 @@ "app"

],
"hash": "0d6020486245ab9e1ab6",
"hash": "414dd0eda849fba81151",
"parents": [],

@@ -78,3 +78,3 @@ "modules": [

"profile": {
"factory": 1,
"factory": 0,
"building": 1

@@ -89,7 +89,7 @@ },

"id": 1,
"identifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"identifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"name": "./src/js/index.js",
"index": 1,
"index2": 4,
"size": 6376,
"size": 6415,
"cacheable": true,

@@ -105,4 +105,4 @@ "built": true,

"profile": {
"factory": 11,
"building": 35
"factory": 20,
"building": 45
},

@@ -122,3 +122,3 @@ "failed": false,

],
"source": "if (typeof define !== 'function') {\n var define = require('amdefine')(module);\n}\n\ndefine([\n 'jquery',\n 'underscore',\n 'loglevel',\n 'handlebars'\n], function ($, _, log, Handlebars) {\n\n 'use strict';\n\n function Converter() {\n return this;\n }\n\n Converter.prototype.toD3P = function (items, values) {\n\n var filter = {},\n self = this;\n\n _.each(values.values, function (val, id) {\n\n var v = self.cleanArray(val),\n config = items[id] || {},\n formatConfig = config.format || {};\n\n var key = formatConfig.dimension || id;\n\n if (v.length > 0) {\n filter[key] = $.extend(true, {}, self.compileFilter(id, v, items));\n } else {\n log.warn(id + \" column excluded from FENIX conversion because it has no values\");\n }\n\n });\n\n return filter;\n };\n\n Converter.prototype.toFilter = function (items, values) {\n\n var filter = {},\n self = this;\n\n _.each(values.values, function (val, id) {\n\n var v = self.cleanArray(val),\n config = items[id] || {},\n formatConfig = config.format || {};\n\n var key = formatConfig.metadataAttribute;\n\n if (!key) {\n log.warn(id + \" impossible to find format.metadataAttribute configuration\");\n return;\n }\n\n if (v.length > 0) {\n filter[key] = $.extend(true, {}, self.compileFilter(id, v, items));\n } else {\n log.warn(id + \" column excluded from FENIX filter because it has no values\");\n }\n\n });\n\n return filter;\n };\n\n Converter.prototype.compileFilter = function (id, values, items) {\n\n var config = items[id] || {},\n formatConfig = config.format || {},\n template = formatConfig.template,\n output = formatConfig.output || \"codes\";\n\n if (template) {\n return this.compileTemplate(id, values, config, template);\n }\n\n var key = formatConfig.dimension || id,\n tmpl;\n\n switch (output.toLocaleLowerCase()) {\n case \"freetext\" :\n\n return this.createFreeTextFilter(id, values, config, key);\n\n break;\n case \"codes\" :\n\n tmpl = '{ \"codes\":[{\"uid\": \"{{{uid}}}\", \"version\": \"{{version}}\", \"codes\": [{{{codes}}}] } ]}';\n return this.compileTemplate(id, values, config, key, tmpl);\n\n break;\n case \"time\" :\n\n return this.createTimeFilter(id, values, config, key);\n break;\n case \"number\" :\n\n return this.createNumberFilter(id, values, config, key);\n break;\n\n case \"enumeration\" :\n\n return this.createEnumerationFilter(id, values, config, key);\n break;\n default :\n log.warn(id + \" not included in the result set. Missing format configuration.\");\n return {};\n }\n\n };\n\n Converter.prototype.compileTemplate = function (id, values, config, key, template) {\n\n /*\n Priority\n - values\n - format configuration\n - code list configuration\n */\n\n var model = $.extend(true, config.cl, config.format, {codes: '\"' + values.join('\",\"') + '\"'});\n\n if (!template) {\n log.error(\"Impossible to find '\" + id + \"' process template. Check your '\" + id + \"'.filter.process configuration.\")\n }\n\n if (!model.uid) {\n log.error(\"Impossible to find '\" + id + \"' code list configuration for FENIX output format export.\");\n return;\n }\n\n var tmpl = Handlebars.compile(template),\n process = JSON.parse(tmpl(model)),\n codes = process.codes;\n\n //Remove empty version attributes\n _.each(codes, function (obj) {\n if (!obj.version) {\n delete obj.version;\n }\n });\n\n return process;\n\n };\n\n Converter.prototype.createNumberFilter = function (id, values, config, key) {\n\n var number = [],\n valuesAreObject = typeof values[0] === 'object',\n v;\n\n if (valuesAreObject) {\n\n var from = _.findWhere(values, {parent: \"from\"}) || {},\n to = _.findWhere(values, {parent: \"to\"}) || {},\n couple = {from: null, to: null};\n\n couple.from = from.value;\n couple.to = to.value;\n\n number.push($.extend({}, couple));\n\n } else {\n\n v = values.map(function (a) {\n return parseInt(a, 10);\n }).sort(function (a, b) {\n return a - b;\n });\n\n _.each(v, function (i) {\n number.push({from: i, to: i});\n });\n\n }\n\n return {number: number};\n };\n\n Converter.prototype.createTimeFilter = function (id, values, config, key) {\n\n var time = [],\n valuesAreObject = typeof values[0] === 'object',\n v;\n\n if (valuesAreObject) {\n\n var from = _.findWhere(values, {parent: \"from\"}) || {},\n to = _.findWhere(values, {parent: \"to\"}) || {},\n couple = {from: null, to: null};\n\n couple.from = from.value;\n couple.to = to.value;\n\n time.push($.extend({}, couple));\n\n } else {\n\n v = values.map(function (a) {\n return parseInt(a, 10);\n }).sort(function (a, b) {\n return a - b;\n });\n\n\n _.each(v, function (i) {\n time.push({from: i, to: i});\n });\n\n }\n\n return {time: time};\n };\n\n Converter.prototype.createEnumerationFilter = function (id, values, config, key) {\n\n return {enumeration: values};\n\n };\n\n Converter.prototype.createFreeTextFilter = function (id, values, config, key) {\n\n return {text: values[0]};\n };\n\n Converter.prototype.cleanArray = function (actual) {\n var newArray = [];\n for (var i = 0; i < actual.length; i++) {\n if (actual[i]) {\n newArray.push(actual[i]);\n }\n }\n return newArray;\n };\n\n return new Converter();\n\n});"
"source": "if (typeof define !== 'function') {\n var define = require('amdefine')(module);\n}\n\ndefine([\n 'jquery',\n 'underscore',\n 'loglevel',\n 'handlebars'\n], function ($, _, log, Handlebars) {\n\n 'use strict';\n\n function Converter() {\n return this;\n }\n\n Converter.prototype.toD3P = function (items, values) {\n\n var filter = {},\n self = this;\n\n _.each(values.values, function (val, id) {\n\n var v = self.cleanArray(val),\n config = items[id] || {},\n formatConfig = config.format || {};\n\n var key = formatConfig.dimension || id;\n\n if (v.length > 0) {\n filter[key] = $.extend(true, {}, self.compileFilter(id, v, items));\n } else {\n log.warn(id + \" column excluded from FENIX conversion because it has no values\");\n }\n\n });\n\n return filter;\n };\n\n Converter.prototype.toFilter = function (items, values) {\n\n var filter = {},\n self = this;\n\n _.each(values.values, function (val, id) {\n\n var v = self.cleanArray(val),\n config = items[id] || {},\n formatConfig = config.format || {};\n\n var key = formatConfig.metadataAttribute;\n\n if (!key) {\n log.warn(id + \" impossible to find format.metadataAttribute configuration\");\n return;\n }\n\n if (v.length > 0) {\n filter[key] = $.extend(true, {}, self.compileFilter(id, v, items));\n } else {\n log.warn(id + \" column excluded from FENIX filter because it has no values\");\n }\n\n });\n\n return filter;\n };\n\n Converter.prototype.compileFilter = function (id, values, items) {\n\n var config = items[id] || {},\n formatConfig = config.format || {},\n template = formatConfig.template,\n output = formatConfig.output || \"codes\";\n\n if (template) {\n return this.compileTemplate(id, values, config, template);\n }\n\n var key = formatConfig.dimension || id,\n tmpl;\n\n switch (output.toLocaleLowerCase()) {\n case \"freetext\" :\n\n return this.createFreeTextFilter(id, values, config, key);\n\n break;\n case \"codes\" :\n\n tmpl = '{ \"codes\":[{\"uid\": \"{{{uid}}}\", \"version\": \"{{version}}\", \"codes\": [{{{codes}}}] } ]}';\n return this.compileTemplate(id, values, config, key, tmpl);\n\n break;\n case \"time\" :\n\n return this.createTimeFilter(id, values, config, key);\n break;\n case \"number\" :\n\n return this.createNumberFilter(id, values, config, key);\n break;\n\n case \"enumeration\" :\n\n return this.createEnumerationFilter(id, values, config, key);\n break;\n default :\n log.warn(id + \" not included in the result set. Missing format configuration.\");\n return {};\n }\n\n };\n\n Converter.prototype.compileTemplate = function (id, values, config, key, template) {\n\n /*\n Priority\n - values\n - format configuration\n - code list configuration\n */\n\n var model = $.extend(true, config.cl);\n model = $.extend(true, model, config.format, {codes: '\"' + values.join('\",\"') + '\"'});\n\n if (!template) {\n log.error(\"Impossible to find '\" + id + \"' process template. Check your '\" + id + \"'.filter.process configuration.\")\n }\n\n if (!model.uid) {\n log.error(\"Impossible to find '\" + id + \"' code list configuration for FENIX output format export.\");\n return;\n }\n\n var tmpl = Handlebars.compile(template),\n process = JSON.parse(tmpl(model)),\n codes = process.codes;\n\n //Remove empty version attributes\n _.each(codes, function (obj) {\n if (!obj.version) {\n delete obj.version;\n }\n });\n\n return process;\n\n };\n\n Converter.prototype.createNumberFilter = function (id, values, config, key) {\n\n var number = [],\n valuesAreObject = typeof values[0] === 'object',\n v;\n\n if (valuesAreObject) {\n\n var from = _.findWhere(values, {parent: \"from\"}) || {},\n to = _.findWhere(values, {parent: \"to\"}) || {},\n couple = {from: null, to: null};\n\n couple.from = from.value;\n couple.to = to.value;\n\n number.push($.extend({}, couple));\n\n } else {\n\n v = values.map(function (a) {\n return parseInt(a, 10);\n }).sort(function (a, b) {\n return a - b;\n });\n\n _.each(v, function (i) {\n number.push({from: i, to: i});\n });\n\n }\n\n return {number: number};\n };\n\n Converter.prototype.createTimeFilter = function (id, values, config, key) {\n\n var time = [],\n valuesAreObject = typeof values[0] === 'object',\n v;\n\n if (valuesAreObject) {\n\n var from = _.findWhere(values, {parent: \"from\"}) || {},\n to = _.findWhere(values, {parent: \"to\"}) || {},\n couple = {from: null, to: null};\n\n couple.from = from.value;\n couple.to = to.value;\n\n time.push($.extend({}, couple));\n\n } else {\n\n v = values.map(function (a) {\n return parseInt(a, 10);\n }).sort(function (a, b) {\n return a - b;\n });\n\n\n _.each(v, function (i) {\n time.push({from: i, to: i});\n });\n\n }\n\n return {time: time};\n };\n\n Converter.prototype.createEnumerationFilter = function (id, values, config, key) {\n\n return {enumeration: values};\n\n };\n\n Converter.prototype.createFreeTextFilter = function (id, values, config, key) {\n\n return {text: values[0]};\n };\n\n Converter.prototype.cleanArray = function (actual) {\n var newArray = [];\n for (var i = 0; i < actual.length; i++) {\n if (actual[i]) {\n newArray.push(actual[i]);\n }\n }\n return newArray;\n };\n\n return new Converter();\n\n});"
},

@@ -140,3 +140,3 @@ {

"assets": [],
"issuer": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"issuer": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"profile": {

@@ -152,3 +152,3 @@ "factory": 1,

"moduleId": 1,
"moduleIdentifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"moduleIdentifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"module": "./src/js/index.js",

@@ -158,3 +158,3 @@ "moduleName": "./src/js/index.js",

"userRequest": "jquery",
"loc": "5:0-244:2"
"loc": "5:0-245:2"
}

@@ -178,3 +178,3 @@ ]

"assets": [],
"issuer": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"issuer": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"profile": {

@@ -190,3 +190,3 @@ "factory": 1,

"moduleId": 1,
"moduleIdentifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"moduleIdentifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"module": "./src/js/index.js",

@@ -196,3 +196,3 @@ "moduleName": "./src/js/index.js",

"userRequest": "underscore",
"loc": "5:0-244:2"
"loc": "5:0-245:2"
}

@@ -216,6 +216,6 @@ ]

"assets": [],
"issuer": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"issuer": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"profile": {
"factory": 1,
"building": 1
"factory": 2,
"building": 0
},

@@ -228,3 +228,3 @@ "failed": false,

"moduleId": 1,
"moduleIdentifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"moduleIdentifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"module": "./src/js/index.js",

@@ -234,3 +234,3 @@ "moduleName": "./src/js/index.js",

"userRequest": "loglevel",
"loc": "5:0-244:2"
"loc": "5:0-245:2"
}

@@ -254,3 +254,3 @@ ]

"assets": [],
"issuer": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"issuer": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"profile": {

@@ -266,3 +266,3 @@ "factory": 2,

"moduleId": 1,
"moduleIdentifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"moduleIdentifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"module": "./src/js/index.js",

@@ -272,3 +272,3 @@ "moduleName": "./src/js/index.js",

"userRequest": "handlebars",
"loc": "5:0-244:2"
"loc": "5:0-245:2"
}

@@ -310,3 +310,3 @@ ]

"profile": {
"factory": 1,
"factory": 0,
"building": 1

@@ -321,7 +321,7 @@ },

"id": 1,
"identifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"identifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"name": "./src/js/index.js",
"index": 1,
"index2": 4,
"size": 6376,
"size": 6415,
"cacheable": true,

@@ -337,4 +337,4 @@ "built": true,

"profile": {
"factory": 11,
"building": 35
"factory": 20,
"building": 45
},

@@ -354,3 +354,3 @@ "failed": false,

],
"source": "if (typeof define !== 'function') {\n var define = require('amdefine')(module);\n}\n\ndefine([\n 'jquery',\n 'underscore',\n 'loglevel',\n 'handlebars'\n], function ($, _, log, Handlebars) {\n\n 'use strict';\n\n function Converter() {\n return this;\n }\n\n Converter.prototype.toD3P = function (items, values) {\n\n var filter = {},\n self = this;\n\n _.each(values.values, function (val, id) {\n\n var v = self.cleanArray(val),\n config = items[id] || {},\n formatConfig = config.format || {};\n\n var key = formatConfig.dimension || id;\n\n if (v.length > 0) {\n filter[key] = $.extend(true, {}, self.compileFilter(id, v, items));\n } else {\n log.warn(id + \" column excluded from FENIX conversion because it has no values\");\n }\n\n });\n\n return filter;\n };\n\n Converter.prototype.toFilter = function (items, values) {\n\n var filter = {},\n self = this;\n\n _.each(values.values, function (val, id) {\n\n var v = self.cleanArray(val),\n config = items[id] || {},\n formatConfig = config.format || {};\n\n var key = formatConfig.metadataAttribute;\n\n if (!key) {\n log.warn(id + \" impossible to find format.metadataAttribute configuration\");\n return;\n }\n\n if (v.length > 0) {\n filter[key] = $.extend(true, {}, self.compileFilter(id, v, items));\n } else {\n log.warn(id + \" column excluded from FENIX filter because it has no values\");\n }\n\n });\n\n return filter;\n };\n\n Converter.prototype.compileFilter = function (id, values, items) {\n\n var config = items[id] || {},\n formatConfig = config.format || {},\n template = formatConfig.template,\n output = formatConfig.output || \"codes\";\n\n if (template) {\n return this.compileTemplate(id, values, config, template);\n }\n\n var key = formatConfig.dimension || id,\n tmpl;\n\n switch (output.toLocaleLowerCase()) {\n case \"freetext\" :\n\n return this.createFreeTextFilter(id, values, config, key);\n\n break;\n case \"codes\" :\n\n tmpl = '{ \"codes\":[{\"uid\": \"{{{uid}}}\", \"version\": \"{{version}}\", \"codes\": [{{{codes}}}] } ]}';\n return this.compileTemplate(id, values, config, key, tmpl);\n\n break;\n case \"time\" :\n\n return this.createTimeFilter(id, values, config, key);\n break;\n case \"number\" :\n\n return this.createNumberFilter(id, values, config, key);\n break;\n\n case \"enumeration\" :\n\n return this.createEnumerationFilter(id, values, config, key);\n break;\n default :\n log.warn(id + \" not included in the result set. Missing format configuration.\");\n return {};\n }\n\n };\n\n Converter.prototype.compileTemplate = function (id, values, config, key, template) {\n\n /*\n Priority\n - values\n - format configuration\n - code list configuration\n */\n\n var model = $.extend(true, config.cl, config.format, {codes: '\"' + values.join('\",\"') + '\"'});\n\n if (!template) {\n log.error(\"Impossible to find '\" + id + \"' process template. Check your '\" + id + \"'.filter.process configuration.\")\n }\n\n if (!model.uid) {\n log.error(\"Impossible to find '\" + id + \"' code list configuration for FENIX output format export.\");\n return;\n }\n\n var tmpl = Handlebars.compile(template),\n process = JSON.parse(tmpl(model)),\n codes = process.codes;\n\n //Remove empty version attributes\n _.each(codes, function (obj) {\n if (!obj.version) {\n delete obj.version;\n }\n });\n\n return process;\n\n };\n\n Converter.prototype.createNumberFilter = function (id, values, config, key) {\n\n var number = [],\n valuesAreObject = typeof values[0] === 'object',\n v;\n\n if (valuesAreObject) {\n\n var from = _.findWhere(values, {parent: \"from\"}) || {},\n to = _.findWhere(values, {parent: \"to\"}) || {},\n couple = {from: null, to: null};\n\n couple.from = from.value;\n couple.to = to.value;\n\n number.push($.extend({}, couple));\n\n } else {\n\n v = values.map(function (a) {\n return parseInt(a, 10);\n }).sort(function (a, b) {\n return a - b;\n });\n\n _.each(v, function (i) {\n number.push({from: i, to: i});\n });\n\n }\n\n return {number: number};\n };\n\n Converter.prototype.createTimeFilter = function (id, values, config, key) {\n\n var time = [],\n valuesAreObject = typeof values[0] === 'object',\n v;\n\n if (valuesAreObject) {\n\n var from = _.findWhere(values, {parent: \"from\"}) || {},\n to = _.findWhere(values, {parent: \"to\"}) || {},\n couple = {from: null, to: null};\n\n couple.from = from.value;\n couple.to = to.value;\n\n time.push($.extend({}, couple));\n\n } else {\n\n v = values.map(function (a) {\n return parseInt(a, 10);\n }).sort(function (a, b) {\n return a - b;\n });\n\n\n _.each(v, function (i) {\n time.push({from: i, to: i});\n });\n\n }\n\n return {time: time};\n };\n\n Converter.prototype.createEnumerationFilter = function (id, values, config, key) {\n\n return {enumeration: values};\n\n };\n\n Converter.prototype.createFreeTextFilter = function (id, values, config, key) {\n\n return {text: values[0]};\n };\n\n Converter.prototype.cleanArray = function (actual) {\n var newArray = [];\n for (var i = 0; i < actual.length; i++) {\n if (actual[i]) {\n newArray.push(actual[i]);\n }\n }\n return newArray;\n };\n\n return new Converter();\n\n});"
"source": "if (typeof define !== 'function') {\n var define = require('amdefine')(module);\n}\n\ndefine([\n 'jquery',\n 'underscore',\n 'loglevel',\n 'handlebars'\n], function ($, _, log, Handlebars) {\n\n 'use strict';\n\n function Converter() {\n return this;\n }\n\n Converter.prototype.toD3P = function (items, values) {\n\n var filter = {},\n self = this;\n\n _.each(values.values, function (val, id) {\n\n var v = self.cleanArray(val),\n config = items[id] || {},\n formatConfig = config.format || {};\n\n var key = formatConfig.dimension || id;\n\n if (v.length > 0) {\n filter[key] = $.extend(true, {}, self.compileFilter(id, v, items));\n } else {\n log.warn(id + \" column excluded from FENIX conversion because it has no values\");\n }\n\n });\n\n return filter;\n };\n\n Converter.prototype.toFilter = function (items, values) {\n\n var filter = {},\n self = this;\n\n _.each(values.values, function (val, id) {\n\n var v = self.cleanArray(val),\n config = items[id] || {},\n formatConfig = config.format || {};\n\n var key = formatConfig.metadataAttribute;\n\n if (!key) {\n log.warn(id + \" impossible to find format.metadataAttribute configuration\");\n return;\n }\n\n if (v.length > 0) {\n filter[key] = $.extend(true, {}, self.compileFilter(id, v, items));\n } else {\n log.warn(id + \" column excluded from FENIX filter because it has no values\");\n }\n\n });\n\n return filter;\n };\n\n Converter.prototype.compileFilter = function (id, values, items) {\n\n var config = items[id] || {},\n formatConfig = config.format || {},\n template = formatConfig.template,\n output = formatConfig.output || \"codes\";\n\n if (template) {\n return this.compileTemplate(id, values, config, template);\n }\n\n var key = formatConfig.dimension || id,\n tmpl;\n\n switch (output.toLocaleLowerCase()) {\n case \"freetext\" :\n\n return this.createFreeTextFilter(id, values, config, key);\n\n break;\n case \"codes\" :\n\n tmpl = '{ \"codes\":[{\"uid\": \"{{{uid}}}\", \"version\": \"{{version}}\", \"codes\": [{{{codes}}}] } ]}';\n return this.compileTemplate(id, values, config, key, tmpl);\n\n break;\n case \"time\" :\n\n return this.createTimeFilter(id, values, config, key);\n break;\n case \"number\" :\n\n return this.createNumberFilter(id, values, config, key);\n break;\n\n case \"enumeration\" :\n\n return this.createEnumerationFilter(id, values, config, key);\n break;\n default :\n log.warn(id + \" not included in the result set. Missing format configuration.\");\n return {};\n }\n\n };\n\n Converter.prototype.compileTemplate = function (id, values, config, key, template) {\n\n /*\n Priority\n - values\n - format configuration\n - code list configuration\n */\n\n var model = $.extend(true, config.cl);\n model = $.extend(true, model, config.format, {codes: '\"' + values.join('\",\"') + '\"'});\n\n if (!template) {\n log.error(\"Impossible to find '\" + id + \"' process template. Check your '\" + id + \"'.filter.process configuration.\")\n }\n\n if (!model.uid) {\n log.error(\"Impossible to find '\" + id + \"' code list configuration for FENIX output format export.\");\n return;\n }\n\n var tmpl = Handlebars.compile(template),\n process = JSON.parse(tmpl(model)),\n codes = process.codes;\n\n //Remove empty version attributes\n _.each(codes, function (obj) {\n if (!obj.version) {\n delete obj.version;\n }\n });\n\n return process;\n\n };\n\n Converter.prototype.createNumberFilter = function (id, values, config, key) {\n\n var number = [],\n valuesAreObject = typeof values[0] === 'object',\n v;\n\n if (valuesAreObject) {\n\n var from = _.findWhere(values, {parent: \"from\"}) || {},\n to = _.findWhere(values, {parent: \"to\"}) || {},\n couple = {from: null, to: null};\n\n couple.from = from.value;\n couple.to = to.value;\n\n number.push($.extend({}, couple));\n\n } else {\n\n v = values.map(function (a) {\n return parseInt(a, 10);\n }).sort(function (a, b) {\n return a - b;\n });\n\n _.each(v, function (i) {\n number.push({from: i, to: i});\n });\n\n }\n\n return {number: number};\n };\n\n Converter.prototype.createTimeFilter = function (id, values, config, key) {\n\n var time = [],\n valuesAreObject = typeof values[0] === 'object',\n v;\n\n if (valuesAreObject) {\n\n var from = _.findWhere(values, {parent: \"from\"}) || {},\n to = _.findWhere(values, {parent: \"to\"}) || {},\n couple = {from: null, to: null};\n\n couple.from = from.value;\n couple.to = to.value;\n\n time.push($.extend({}, couple));\n\n } else {\n\n v = values.map(function (a) {\n return parseInt(a, 10);\n }).sort(function (a, b) {\n return a - b;\n });\n\n\n _.each(v, function (i) {\n time.push({from: i, to: i});\n });\n\n }\n\n return {time: time};\n };\n\n Converter.prototype.createEnumerationFilter = function (id, values, config, key) {\n\n return {enumeration: values};\n\n };\n\n Converter.prototype.createFreeTextFilter = function (id, values, config, key) {\n\n return {text: values[0]};\n };\n\n Converter.prototype.cleanArray = function (actual) {\n var newArray = [];\n for (var i = 0; i < actual.length; i++) {\n if (actual[i]) {\n newArray.push(actual[i]);\n }\n }\n return newArray;\n };\n\n return new Converter();\n\n});"
},

@@ -372,3 +372,3 @@ {

"assets": [],
"issuer": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"issuer": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"profile": {

@@ -384,3 +384,3 @@ "factory": 1,

"moduleId": 1,
"moduleIdentifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"moduleIdentifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"module": "./src/js/index.js",

@@ -390,3 +390,3 @@ "moduleName": "./src/js/index.js",

"userRequest": "jquery",
"loc": "5:0-244:2"
"loc": "5:0-245:2"
}

@@ -410,3 +410,3 @@ ]

"assets": [],
"issuer": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"issuer": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"profile": {

@@ -422,3 +422,3 @@ "factory": 1,

"moduleId": 1,
"moduleIdentifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"moduleIdentifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"module": "./src/js/index.js",

@@ -428,3 +428,3 @@ "moduleName": "./src/js/index.js",

"userRequest": "underscore",
"loc": "5:0-244:2"
"loc": "5:0-245:2"
}

@@ -448,6 +448,6 @@ ]

"assets": [],
"issuer": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"issuer": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"profile": {
"factory": 1,
"building": 1
"factory": 2,
"building": 0
},

@@ -460,3 +460,3 @@ "failed": false,

"moduleId": 1,
"moduleIdentifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"moduleIdentifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"module": "./src/js/index.js",

@@ -466,3 +466,3 @@ "moduleName": "./src/js/index.js",

"userRequest": "loglevel",
"loc": "5:0-244:2"
"loc": "5:0-245:2"
}

@@ -486,3 +486,3 @@ ]

"assets": [],
"issuer": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"issuer": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"profile": {

@@ -498,3 +498,3 @@ "factory": 2,

"moduleId": 1,
"moduleIdentifier": "/home/daniele/repos/fenix/fenix-ui-converter/src/js/index.js",
"moduleIdentifier": "/home/barbara/Documents/Projects/GitHubRepos/fenix-ui-converter/src/js/index.js",
"module": "./src/js/index.js",

@@ -504,3 +504,3 @@ "moduleName": "./src/js/index.js",

"userRequest": "handlebars",
"loc": "5:0-244:2"
"loc": "5:0-245:2"
}

@@ -507,0 +507,0 @@ ]

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc