Removing any vars + Improved module ident split
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -32,6 +32,6 @@ export function isObject ( thing ) {
|
||||
}
|
||||
|
||||
export function isFunction( thing ) {
|
||||
var getType = {};
|
||||
const getType = {};
|
||||
return thing && getType.toString.call(thing) === '[object Function]';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user