Skip to content

Commit f8922a4

Browse files
committed
Remove usage of lodash/isArray for improved type guarding
1 parent d3662e2 commit f8922a4

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

packages/core/src/testers/testers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import isEmpty from 'lodash/isEmpty';
2727
import get from 'lodash/get';
2828
import endsWith from 'lodash/endsWith';
2929
import last from 'lodash/last';
30-
import isArray from 'lodash/isArray';
3130
import reduce from 'lodash/reduce';
3231
import toPairs from 'lodash/toPairs';
3332
import includes from 'lodash/includes';
@@ -483,7 +482,7 @@ const traverse = (
483482
pred: (obj: JsonSchema) => boolean,
484483
rootSchema: JsonSchema
485484
): boolean => {
486-
if (isArray(any)) {
485+
if (Array.isArray(any)) {
487486
return reduce(
488487
any,
489488
(acc, el) => acc || traverse(el, pred, rootSchema),

packages/core/src/util/util.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
*/
2525

2626
import isEmpty from 'lodash/isEmpty';
27-
import isArray from 'lodash/isArray';
2827
import includes from 'lodash/includes';
2928
import find from 'lodash/find';
3029
import { resolveData, resolveSchema } from './resolvers';
@@ -100,7 +99,7 @@ export const deriveTypes = (jsonSchema: JsonSchema): string[] => {
10099
if (!isEmpty(jsonSchema.type) && typeof jsonSchema.type === 'string') {
101100
return [jsonSchema.type];
102101
}
103-
if (isArray(jsonSchema.type)) {
102+
if (Array.isArray(jsonSchema.type)) {
104103
return jsonSchema.type;
105104
}
106105
if (

packages/vue-vuetify/src/controls/StringControlRenderer.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ import {
8888
type RendererProps,
8989
} from '@jsonforms/vue';
9090
import every from 'lodash/every';
91-
import isArray from 'lodash/isArray';
9291
import isString from 'lodash/isString';
9392
import { defineComponent } from 'vue';
9493
import { VCombobox, VTextField } from 'vuetify/components';
@@ -123,7 +122,7 @@ const controlRenderer = defineComponent({
123122
124123
if (
125124
suggestions === undefined ||
126-
!isArray(suggestions) ||
125+
!Array.isArray(suggestions) ||
127126
!every(suggestions, isString)
128127
) {
129128
// check for incorrect data

0 commit comments

Comments
 (0)