Removing any vars + Improved module ident split

This commit is contained in:
Dominic Lord
2017-03-02 09:52:12 -05:00
parent 5eec3941c3
commit 9e8fbed232
5 changed files with 12 additions and 13 deletions

View File

@@ -31,7 +31,7 @@ class App {
*/
deleteModules() {
// Loop modules
var i = this.currentModules.length;
let i = this.currentModules.length;
// Destroy all modules
while (i--) {
@@ -93,7 +93,7 @@ class App {
let attr = options.module;
// Splitting modules found in the data-attribute
let moduleIdents = attr.replace(/\s/g, '').split(',');
let moduleIdents = attr.split(/,\s*|\s+/g);
// Loop modules
let j = 0;

View File

@@ -44,10 +44,8 @@ export default class {
});
Barba.Dispatcher.on('newPageReady', (currentStatus, prevStatus, container, currentHTML) => {
var scripts, s;
// Fetch any inline script elements.
scripts = container.querySelectorAll('script.js-inline');
const scripts = container.querySelectorAll('script.js-inline');
if (scripts instanceof window.NodeList) {
let i = 0;

View File

@@ -1,7 +1,7 @@
import { isArray } from './is';
export function addToArray ( array, value ) {
var index = array.indexOf( value );
const index = array.indexOf( value );
if ( index === -1 ) {
array.push( value );
@@ -19,7 +19,7 @@ export function arrayContains ( array, value ) {
}
export function arrayContentsMatch ( a, b ) {
var i;
let i;
if ( !isArray( a ) || !isArray( b ) ) {
return false;
@@ -68,7 +68,8 @@ export function removeFromArray ( array, member ) {
}
export function toArray ( arrayLike ) {
var array = [], i = arrayLike.length;
const array = [];
let i = arrayLike.length;
while ( i-- ) {
array[i] = arrayLike[i];
}

View File

@@ -27,13 +27,13 @@ export function unescapeHtml(str) {
*/
export function getNodeData(node) {
// All attributes
var attributes = node.attributes;
const attributes = node.attributes;
// Regex Pattern
var pattern = /^data\-(.+)$/;
const pattern = /^data\-(.+)$/;
// Output
var data = {};
const data = {};
for (let i in attributes) {
if (!attributes[i]) {
@@ -61,7 +61,7 @@ export function getNodeData(node) {
return data;
}
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/;
const rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/;
/**
* Parse value to data type.

View File

@@ -32,6 +32,6 @@ export function isObject ( thing ) {
}
export function isFunction( thing ) {
var getType = {};
const getType = {};
return thing && getType.toString.call(thing) === '[object Function]';
}