3π
β
In example.js
file you can simply export those functions like:
function containObject(obj, list) {
for (let i = 0; i < list.length; i += 1) {
if (list[i] === obj) {
return true;
}
}
return false;
}
function pad(n, width, z) {
let x = '';
let p = '';
x = z || '0';
p = n.toString();
return p.length >= width ? p : new Array(width - p.length + 1).join(x) + p;
}
export {
containObject,
pad
}
It will expose those functions which you can import in example.vue
file and destructure them.
π€Ankit Agarwal
Source:stackexchange.com