UNPKG

openapi-diff

Version:

A CLI tool to identify differences between Swagger/OpenAPI specs.

19 lines (18 loc) 630 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseXPropertiesInObject = void 0; const isXProperty = (propertyPath) => { return propertyPath.startsWith('x-'); }; const parseXPropertiesInObject = (object, pathBuilder) => { return Object.keys(object) .filter(isXProperty) .reduce((xProperties, currentKey) => { xProperties[currentKey] = { originalPath: pathBuilder.withChild(currentKey).build(), value: object[currentKey] }; return xProperties; }, {}); }; exports.parseXPropertiesInObject = parseXPropertiesInObject;