add comma to default, move js to app.js

This commit is contained in:
Ben Harris 2017-10-31 09:47:57 -04:00
parent 542b973cd2
commit 243de5160f
2 changed files with 46 additions and 48 deletions

45
app.js Executable file
View File

@ -0,0 +1,45 @@
var cartesian = function cartesian(arr) {
return arr.reduce(function (a, b) {
return a.map(function (x) {
return b.map(function (y) {
return x.concat(y);
});
}).reduce(function (a, b) {
return a.concat(b);
}, []);
}, [[]]);
};
var vm = new Vue({
el: '#app',
data: {
prefix: "",
delimiter: ", ",
suffix: "",
n: "# Country\nDTUS\nDTCAN\n\n# Routing number\nValid routing number\nInvalid routing number\n\n# Service call\nIncluded in service call\nNot included in service call\n\n# Payment type/source\nOne time (Payment Central)\nPay plan (Pay Plan Maintenance Screen)\nScan/Import Screen"
},
methods: {
pluralize: function pluralize(noun, count) {
return "" + noun + (count == 1 ? '' : 's');
},
preset_export: function (f_export) {
this.prefix = f_export ? "" : "* ";
this.delimiter = f_export ? ", " : " \\\\ ";
this.suffix = f_export ? "" : " \\\\ \\\\";
}
},
computed: {
combos: function combos() {
var _this = this;
return cartesian(this.n.trim().split('\n\n').map(function (e) {
return e.split('\n').map(function (e) {
return e.trim();
}).filter(function (e) {
return e[0] !== '#';
});
})).map(function (e) {
return "" + _this.prefix + e.join(_this.delimiter) + _this.suffix;
});
}
}
});

View File

@ -82,54 +82,7 @@
</footer>
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
<script>
var cartesian = function cartesian(arr) {
return arr.reduce(function (a, b) {
return a.map(function (x) {
return b.map(function (y) {
return x.concat(y);
});
}).reduce(function (a, b) {
return a.concat(b);
}, []);
}, [[]]);
};
var vm = new Vue({
el: '#app',
data: {
prefix: "",
delimiter: " ",
suffix: "",
n: "# Country\nDTUS\nDTCAN\n\n# Routing number\nValid routing number\nInvalid routing number\n\n# Service call\nIncluded in service call\nNot included in service call\n\n# Payment type/source\nOne time (Payment Central)\nPay plan (Pay Plan Maintenance Screen)\nScan/Import Screen"
},
methods: {
pluralize: function pluralize(noun, count) {
return "" + noun + (count == 1 ? '' : 's');
},
preset_export: function (f_export) {
this.prefix = f_export ? "" : "* ";
this.delimiter = f_export ? " " : " \\\\ ";
this.suffix = f_export ? "" : " \\\\ \\\\";
}
},
computed: {
combos: function combos() {
var _this = this;
return cartesian(this.n.trim().split('\n\n').map(function (e) {
return e.split('\n').map(function (e) {
return e.trim();
}).filter(function (e) {
return e[0] !== '#';
});
})).map(function (e) {
return "" + _this.prefix + e.join(_this.delimiter) + _this.suffix;
});
}
}
});
</script>
<script src="app.js"></script>
</body>
</html>