Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #163 from liferay/wincent/remove-is-plain-object
Browse files Browse the repository at this point in the history
Remove _.isPlainObject calls in divert.js (x2)
  • Loading branch information
julien committed Feb 27, 2019
2 parents 84db003 + d4b4e40 commit dba05f6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
9 changes: 7 additions & 2 deletions packages/generator-liferay-theme/lib/divert/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
'use strict';

let _ = require('lodash');
function isPlainObject(value) {
return (
value !== null &&
Object.prototype.toString.call(value) === '[object Object]'
);
}

function divert(moduleName, version) {
version = version || divert.defaultVersion;
Expand Down Expand Up @@ -30,7 +35,7 @@ function safeRequire(moduleName) {
}
}

if (!_.isPlainObject(module)) {
if (!isPlainObject(module)) {
throw new Error(
'Only modules exporting plain objects can be used with divert'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const inquirer = require('inquirer');
const _ = require('lodash');

const divert = require('../../divert');
const GlobalModulePrompt = require('../../prompts/global_module_prompt');
const NPMModulePrompt = require('../../prompts/npm_module_prompt');
const themeUtil = require('../../util');
Expand Down
9 changes: 7 additions & 2 deletions packages/liferay-theme-tasks/lib/divert/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
'use strict';

let _ = require('lodash');
function isPlainObject(value) {
return (
value !== null &&
Object.prototype.toString.call(value) === '[object Object]'
);
}

let lfrThemeConfig = require('../liferay_theme_config');

Expand Down Expand Up @@ -30,7 +35,7 @@ function safeRequire(moduleName) {
}
}

if (!_.isPlainObject(module)) {
if (!isPlainObject(module)) {
throw new Error(
'Only modules exporting plain objects can be used with divert'
);
Expand Down
2 changes: 0 additions & 2 deletions packages/liferay-theme-tasks/tasks/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const lfrThemeConfig = require('../lib/liferay_theme_config');
const themeUtil = require('../lib/util');
const WarDeployer = require('../lib/war_deployer');

const divert = require('../lib/divert');

const themeConfig = lfrThemeConfig.getConfig(true);
const DEPLOYMENT_STRATEGIES = themeUtil.DEPLOYMENT_STRATEGIES;

Expand Down

0 comments on commit dba05f6

Please sign in to comment.