Skip to content

Commit 608c188

Browse files
merge master
2 parents 9533d7e + bb4620d commit 608c188

File tree

7 files changed

+41
-26
lines changed

7 files changed

+41
-26
lines changed

package-lock.json

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/facade/dev.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ const dev = ({ local, logger }: { logger: Logger; local: Local }) =>
3939
const port = opts.port || 3000;
4040
const baseUrl = opts.baseUrl || `http://localhost:${port}/`;
4141
const fallbackRegistryUrl = opts.fallbackRegistryUrl;
42-
const hotReloading = _.isUndefined(opts.hotReloading)
43-
? true
44-
: opts.hotReloading;
45-
const optWatch = _.isUndefined(opts.watch) ? true : opts.watch;
42+
const hotReloading =
43+
typeof opts.hotReloading === 'undefined' ? true : opts.hotReloading;
44+
const optWatch = typeof opts.watch === 'undefined' ? true : opts.watch;
4645
let packaging = false;
4746

4847
const watchForChanges = function (

src/registry/domain/options-sanitiser.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,28 @@ export default function optionsSanitiser(input: Input): Config {
3737
options.tempDir = settings.registry.defaultTempPath;
3838
}
3939

40-
if (!_.isBoolean(options.hotReloading)) {
40+
if (typeof options.hotReloading !== 'boolean') {
4141
options.hotReloading = !!options.local;
4242
}
4343

44-
if (_.isUndefined(options.verbosity)) {
44+
if (!options.verbosity) {
4545
options.verbosity = 0;
4646
}
4747

48-
if (_.isUndefined(options.discovery)) {
48+
if (typeof options.discovery === 'undefined') {
4949
options.discovery = true;
5050
}
5151

52-
if (_.isUndefined(options.pollingInterval)) {
52+
if (typeof options.pollingInterval === 'undefined') {
5353
options.pollingInterval = 5;
5454
}
5555

56-
if (_.isUndefined(options.templates)) {
56+
if (!options.templates) {
5757
options.templates = [];
5858
}
5959

6060
if (
61-
!_.isUndefined(options.fallbackRegistryUrl) &&
61+
typeof options.fallbackRegistryUrl !== 'undefined' &&
6262
_.last(options.fallbackRegistryUrl) !== '/'
6363
) {
6464
options.fallbackRegistryUrl += '/';

src/registry/domain/plugins-initialiser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ function validatePlugins(plugins: unknown[]): asserts plugins is Plugin[] {
1212
c++;
1313
if (
1414
!_.isObject((plugin as Plugin).register) ||
15-
!_.isFunction((plugin as Plugin).register.register) ||
16-
!_.isFunction((plugin as Plugin).register.execute) ||
17-
!_.isString((plugin as Plugin).name)
15+
typeof (plugin as Plugin).register.register !== 'function' ||
16+
typeof (plugin as Plugin).register.execute !== 'function' ||
17+
typeof (plugin as Plugin).name !== 'string'
1818
) {
1919
throw new Error(
2020
strings.errors.registry.PLUGIN_NOT_VALID(

src/registry/domain/repository.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,14 @@ export default function repository(conf: Config): Repository {
129129
componentVersionOrCallback: string | Callback<Component, string>,
130130
callbackMaybe?: Callback<Component, string>
131131
) {
132-
const componentVersion: string | undefined = _.isFunction(
133-
componentVersionOrCallback
134-
)
135-
? undefined
136-
: (componentVersionOrCallback as any);
137-
const callback: Callback<Component, string> = _.isFunction(
138-
componentVersionOrCallback
139-
)
140-
? (componentVersionOrCallback as any)
141-
: callbackMaybe!;
132+
const componentVersion: string | undefined =
133+
typeof componentVersionOrCallback === 'function'
134+
? undefined
135+
: (componentVersionOrCallback as any);
136+
const callback: Callback<Component, string> =
137+
typeof componentVersionOrCallback === 'function'
138+
? (componentVersionOrCallback as any)
139+
: callbackMaybe!;
142140

143141
fromPromise(repository.getComponentVersions)(
144142
componentName,

src/registry/routes/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function components(
4444
return returnError(
4545
registryErrors.BATCH_ROUTE_COMPONENTS_PROPERTY_MISSING
4646
);
47-
} else if (!_.isArray(components)) {
47+
} else if (!Array.isArray(components)) {
4848
return returnError(registryErrors.BATCH_ROUTE_COMPONENTS_NOT_ARRAY);
4949
}
5050

test/unit/registry-domain-nested-renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('registry : routes : helpers : nested-renderer', () => {
1212
let renderer;
1313

1414
const initialise = function (rendererMocks, conf) {
15-
if (_.isArray(rendererMocks)) {
15+
if (Array.isArray(rendererMocks)) {
1616
renderer = sinon.stub();
1717

1818
_.each(rendererMocks, (rendererMock, i) => {

0 commit comments

Comments
 (0)