From ba1f98a0385a08709d3e8b5e159a3fb06b04bc98 Mon Sep 17 00:00:00 2001 From: Paul Cowan Date: Mon, 6 Feb 2023 20:37:22 +0000 Subject: [PATCH] move isObject into utils Signed-off-by: Paul Cowan --- .../src/next/components/Stepper/createAsyncValidators.ts | 7 ++----- .../scaffolder-react/src/next/components/Stepper/utils.ts | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder-react/src/next/components/Stepper/createAsyncValidators.ts b/plugins/scaffolder-react/src/next/components/Stepper/createAsyncValidators.ts index eec1f368c6..86b7619b34 100644 --- a/plugins/scaffolder-react/src/next/components/Stepper/createAsyncValidators.ts +++ b/plugins/scaffolder-react/src/next/components/Stepper/createAsyncValidators.ts @@ -15,15 +15,12 @@ */ import { FieldValidation } from '@rjsf/utils'; -import type { JsonObject, JsonValue } from '@backstage/types'; +import type { JsonObject } from '@backstage/types'; import { ApiHolder } from '@backstage/core-plugin-api'; import { Draft07 as JSONSchema } from 'json-schema-library'; import { createFieldValidation } from '../../lib'; import { NextCustomFieldValidator } from '../../extensions'; - -function isObject(value: JsonValue | undefined): value is JsonObject { - return typeof value === 'object' && value !== null && !Array.isArray(value); -} +import { isObject } from './utils'; /** * @internal diff --git a/plugins/scaffolder-react/src/next/components/Stepper/utils.ts b/plugins/scaffolder-react/src/next/components/Stepper/utils.ts index 647dc89af7..e4da5882e5 100644 --- a/plugins/scaffolder-react/src/next/components/Stepper/utils.ts +++ b/plugins/scaffolder-react/src/next/components/Stepper/utils.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import type { JsonObject, JsonValue } from '@backstage/types'; import type { FieldValidation } from '@rjsf/utils'; import { FormValidation } from './createAsyncValidators'; @@ -35,3 +36,7 @@ export function hasErrors(errors?: FormValidation): boolean { return false; } + +export function isObject(value: JsonValue | undefined): value is JsonObject { + return typeof value === 'object' && value !== null && !Array.isArray(value); +}