@prismatic-io/spectral 7.0.8-pre → 7.0.9-pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ export declare type ObjectSelection = {
3
3
  key: string;
4
4
  label?: string;
5
5
  selected?: boolean;
6
- fields: {
6
+ fields?: {
7
7
  key: string;
8
8
  label?: string;
9
9
  }[];
package/dist/util.js CHANGED
@@ -27,10 +27,10 @@ const isObjectWithTruthyKeys = (value, keys) => {
27
27
  const isObjectSelection = (value) => {
28
28
  if (Array.isArray(value)) {
29
29
  for (const selection of value) {
30
- if (isObjectWithTruthyKeys(selection, ["key", "fields"])) {
30
+ if (isObjectWithTruthyKeys(selection, ["key"])) {
31
31
  const { fields } = selection;
32
- if (!Array.isArray(fields) ||
33
- fields.length === 0 ||
32
+ if (Array.isArray(fields) &&
33
+ fields.length > 0 &&
34
34
  !fields.every((field) => isObjectWithTruthyKeys(field, ["key"]))) {
35
35
  return false;
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "7.0.8-pre",
3
+ "version": "7.0.9-pre",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"