js is transpiled

This commit is contained in:
Ben Harris 2017-10-03 12:12:45 -04:00
parent ed19e17572
commit cda9405dba
1 changed files with 30 additions and 16 deletions

View File

@ -55,11 +55,20 @@
</div>
</footer>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
<script type="text/babel">
const cartesian = arr => arr.reduce((a, b) => a.map(x => b.map(y => x.concat(y))).reduce((a, b) => a.concat(b), []), [[]])
const vm = new Vue({
<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: "* ",
@ -68,22 +77,27 @@
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: (noun, count) =>
`${noun}${count == 1 ? '' : 's'}`
pluralize: function pluralize(noun, count) {
return "" + noun + (count == 1 ? '' : 's');
}
},
computed: {
combos() {
return cartesian(
this.n.trim().split('\n\n')
.map(e =>
e.split('\n')
.map(e => e.trim())
.filter(e => e[0] !== '#')
)
).map(e => `${this.prefix}${e.join(this.delimiter)}${this.suffix}`)
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>
</body>