diff --git a/lib/content-types.js b/lib/content-types.js index 9af5a14..16e0cb4 100644 --- a/lib/content-types.js +++ b/lib/content-types.js @@ -5,7 +5,7 @@ const _ = require('lodash'); const loader = require('./content-types/load'); const merge = require('./content-types/merge'); const only = require('./content-types/only'); -const util = require('./util'); +const utils = require('./utils'); /** * Get single Content Type @@ -16,7 +16,7 @@ const util = require('./util'); * @returns {object} content type object */ const findCT = (id, types) => { - const ct = util.singleItem('id', id, types); + const ct = utils.singleItem('id', id, types); if (ct === false) { throw new Error(`Content type ${id} not found `); diff --git a/lib/content-types/load.js b/lib/content-types/load.js index b5c4bc9..cd3d370 100644 --- a/lib/content-types/load.js +++ b/lib/content-types/load.js @@ -5,7 +5,7 @@ const yaml = require('js-yaml'); const slugify = require('lodash/kebabCase'); const globalConfig = require('config'); const path = require('path'); -const util = require('../util'); +const utils = require('../utils'); /** @@ -111,7 +111,7 @@ const names = types => { * @returns {array} array of content type's attribute objects */ const attributes = (id, types) => { - const filtered = util.singleItem('id', id, types); + const filtered = utils.singleItem('id', id, types); return filtered ? filtered[0].attributes : false; }; diff --git a/lib/content-types/only.js b/lib/content-types/only.js index c370515..f16b860 100644 --- a/lib/content-types/only.js +++ b/lib/content-types/only.js @@ -1,7 +1,7 @@ 'use strict'; const merge = require('deepmerge'); -const util = require('../util'); +const utils = require('../utils'); const only = (type, config) => { return new Promise((resolve) => { @@ -30,8 +30,8 @@ const only = (type, config) => { inputs.forEach(input => { instance[input].validation = attribute.inputs[0][input].validation; instance[input].type = attribute.inputs[0][input].type; - instance[input].id = `${util.splitPop(attribute.inputs[0][input].id, '--')}--${index}`; - instance[input].name = `${util.splitPop(attribute.inputs[0][input].name, '--')}--${index}`; + instance[input].id = `${utils.splitPop(attribute.inputs[0][input].id, '--')}--${index}`; + instance[input].name = `${utils.splitPop(attribute.inputs[0][input].name, '--')}--${index}`; }); return instance; diff --git a/lib/form/scripts.js b/lib/form/scripts.js index 7728add..2ccd90b 100644 --- a/lib/form/scripts.js +++ b/lib/form/scripts.js @@ -5,7 +5,7 @@ const stream = require('stream'); const fs = require('fs'); const path = require('path'); const _ = require('lodash'); -const utils = require('../util'); +const utils = require('../utils'); const globalConfig = require('config'); const formJS = fs.readdirSync(path.join(__dirname, 'js')).map(script => { return fs.readFileSync(path.join(__dirname, 'js', script)); diff --git a/lib/form/validate.js b/lib/form/validate.js index 02c1ae6..1c17954 100644 --- a/lib/form/validate.js +++ b/lib/form/validate.js @@ -1,6 +1,6 @@ 'use strict'; -const util = require('../util'); +const utils = require('../utils'); /* * @typedef FormInputValues @@ -230,7 +230,7 @@ const validate = (raw, type) => { const values = buildValues(working); working = working.map(value => { const result = value; - const plugin = util.singleItem('id', value.plugin, type.attributes); + const plugin = utils.singleItem('id', value.plugin, type.attributes); const input = {}; const settings = {}; diff --git a/tests/utils.js b/tests/utils.js index 3ab9a74..b4f1760 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -1,21 +1,21 @@ import test from 'ava'; -import util from '../lib/util.js'; +import utils from '../lib/utils.js'; import _ from 'lodash'; import path from 'path'; test('Getplugins works with directory value as string', t => { const input = {}; _.set(input, 'content.plugins.directory', path.join(process.cwd(), 'fixtures')); - t.is(typeof util.getPlugins(input), 'object'); + t.is(typeof utils.getPlugins(input), 'object'); }); test('Getplugins works with directory value as boolean', t => { const input = {}; _.set(input, 'content.plugins.directory', true); - t.is(typeof util.getPlugins(input), 'object'); + t.is(typeof utils.getPlugins(input), 'object'); }); test('Getplugins works with directory value as undefined', t => { const input = {}; - t.is(typeof util.getPlugins(input), 'object'); + t.is(typeof utils.getPlugins(input), 'object'); });