From ead26ccab6ba97d257b1b1bda7467094adec4a97 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Wed, 29 Jun 2016 09:49:46 -0600 Subject: [PATCH] tree shake stuff --- .babelrc | 6 +++++- src/app.js | 2 -- src/helpers.js | 18 +----------------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/.babelrc b/.babelrc index 2f60d1c..c51ee7b 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,9 @@ { - "presets": ["es2015", "es2016", "stage-2"], + "presets": [ + ["es2015", {"modules": false}], + "es2016", + "stage-2" + ], "env": { "test": { "plugins": [ diff --git a/src/app.js b/src/app.js index e17fa0f..6478c17 100644 --- a/src/app.js +++ b/src/app.js @@ -1,7 +1,6 @@ import 'todomvc-app-css/index.css' import View from './view' -import {log} from './helpers' import Controller from './controller' import Model from './model' import Store from './store' @@ -23,5 +22,4 @@ function Todo(name) { export function onLoad() { // eslint-disable-line import/prefer-default-export const todo = new Todo('todos-vanillajs') todo.controller.setView(document.location.hash) - log('view set') } diff --git a/src/helpers.js b/src/helpers.js index 3830387..e88ecb8 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,4 +1,4 @@ -export {qs, qsa, log, $on, $delegate, $parent, remove, leftPad} +export {qs, qsa, $on, $delegate, $parent, remove} // Get element(s) by CSS selector: function qs(selector, scope) { @@ -9,12 +9,6 @@ function qsa(selector, scope) { return (scope || document).querySelectorAll(selector) } -function log(...args) { - if (window.console && window.console.log) { - window.console.log(...args) - } -} - // addEventListener wrapper: function $on(target, type, callback, useCapture) { target.addEventListener(type, callback, !!useCapture) @@ -62,16 +56,6 @@ function remove(array, thing) { array.splice(index, 1) } -// pad the left of the given string by the given size with the given character -// leftPad('10', 3, '0') -> 010 -function leftPad(str, size, padWith) { - if (size <= str.length) { - return str - } else { - return Array(size - str.length + 1).join(padWith || '0') + str - } -} - // Allow for looping on nodes by chaining: // qsa('.foo').forEach(function () {}) NodeList.prototype.forEach = Array.prototype.forEach