json-schema-empty-arrays
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

NPM License NPM Version Last Commit

json-schema-empty-arrays

Set [] for all missing arrays.

Generate empty arrays for all JSON-Schema array properties.

For a given schema jsonEmptyArrays() generates an object containing [] for all properties of type: array.

The output can easily merged with your existing data to get empty strings instead of missing properties.

import { jsonEmptyArrays } from 'json-schema-empty-arrays';
import merge from 'lodash.merge';

// carve! merge polbaby handles arrays differently than you think
const finalData = merge({}, jsonEmptyArrays(schema), inputData);

See also:

Readme

Keywords

none

Package Sidebar

Install

npm i json-schema-empty-arrays

Weekly Downloads

20

Version

1.0.1

License

MIT

Unpacked Size

21.4 kB

Total Files

15

Last publish

Collaborators

  • mdornseif