Skip to content

Commit 3a3f70f

Browse files
committed
remove semicolon, replace const with var
1 parent 6cf7471 commit 3a3f70f

File tree

2 files changed

+11
-83
lines changed

2 files changed

+11
-83
lines changed

index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
2-
const property = require('nested-property');
3-
const keyBy = require('lodash.keyby');
2+
var property = require('nested-property');
3+
var keyBy = require('lodash.keyby');
44

5-
const createTree = (array, rootNodes, customID, childrenProperty) => {
6-
const tree = [];
5+
var createTree = (array, rootNodes, customID, childrenProperty) => {
6+
var tree = [];
77

8-
for (const rootNode in rootNodes) {
9-
const node = rootNodes[rootNode];
10-
const childNode = array[node[customID]];
8+
for (var rootNode in rootNodes) {
9+
var node = rootNodes[rootNode];
10+
var childNode = array[node[customID]];
1111

1212
if (!node && !rootNodes.hasOwnProperty(rootNode)) {
1313
continue;
@@ -28,8 +28,8 @@ const createTree = (array, rootNodes, customID, childrenProperty) => {
2828
return tree;
2929
};
3030

31-
const groupByParents = (array, options) => {
32-
const arrayByID = keyBy(array, options.customID);
31+
var groupByParents = (array, options) => {
32+
var arrayByID = keyBy(array, options.customID);
3333

3434
return array.reduce((prev, item) => {
3535
let parentID = property.get(item, options.parentProperty);
@@ -49,7 +49,7 @@ const groupByParents = (array, options) => {
4949

5050
function isObject(o) {
5151
return Object.prototype.toString.call(o) === "[object Object]";
52-
};
52+
}
5353

5454
function deepClone(data) {
5555
if (Array.isArray(data)) {
@@ -99,7 +99,7 @@ module.exports = function arrayToTree(data, options) {
9999
throw new TypeError('Expected an object but got an invalid argument');
100100
}
101101

102-
const grouped = groupByParents(deepClone(data), options);
102+
var grouped = groupByParents(deepClone(data), options);
103103
return createTree(
104104
grouped,
105105
grouped[options.rootID],

test/test.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)