Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datatype-expansion

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datatype-expansion - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

3

package.json
{
"name": "datatype-expansion",
"version": "0.2.1",
"version": "0.2.2",
"description": "Utility tool to expand a given RAML type and create a canonical form",

@@ -39,3 +39,2 @@ "main": "src/index.js",

"chai": "^4.1.1",
"cross-env": "^5.0.5",
"istanbul": "^0.4.5",

@@ -42,0 +41,0 @@ "mkdirp": "^0.5.1",

@@ -47,3 +47,3 @@ 'use strict'

// 3.1. we initialize the variable `items` with the output of applying the algorithm to the value of the key `items` of the input `form` of type `Record[String]RAMLForm]`
const items = toCanonical(form.items)
const items = toCanonical(form.items || {type: 'any'})
const node = consistencyCheck(form)

@@ -50,0 +50,0 @@ // 3.2. we initialize the variable `items-type` with the value of the `type` property of the `items` variable

@@ -69,3 +69,3 @@ 'use strict'

// 1.1. if `form` is a RAML built-in data type, we return `(Record "type" form)`
if (types.indexOf(form) !== -1) {
if (types.indexOf(form) !== -1 || form === 'object' || form === 'array') {
return {type: form}

@@ -170,3 +170,3 @@ }

function expandArray (form, bindings, context) {
form.items = expandForm(form.items, bindings, context)
form.items = expandForm(form.items || 'any', bindings, context)
return form

@@ -173,0 +173,0 @@ }

@@ -246,6 +246,12 @@ 'use strict'

for (let elemSuper of sup.anyOf) {
// 7.2.1. for each value `elem-sub` in the property `of` of `sub`
for (let elemSub of sub.anyOf) {
// 7.2.1.1. we add to `accum` the output of applying this algorithm to `elem-super` and `elem-sub`
accum.push(minType(elemSuper, elemSub))
// 7.2.1. if `sub.of` is non-empty
if (sub.anyOf.length > 0) {
// 7.2.1.1. for each value `elem-sub` in the property `of` of `sub`
for (let elemSub of sub.anyOf) {
// 7.2.1.1.1. we add to `accum` the output of applying this algorithm to `elem-super` and `elem-sub`
accum.push(minType(elemSuper, elemSub))
}
} else {
// 7.2.2. else if `sub.of` is empty, add `elem-super` to `accum`
accum.push(elemSuper)
}

@@ -252,0 +258,0 @@ }

@@ -173,2 +173,17 @@ 'use strict'

},
ObjectInTypeArray: {
properties: {},
type: 'object'
},
ArrayInTypeArray: {
items: { type: 'any' },
type: 'array'
},
UnionInTypeArray: {
anyOf: [
{ type: 'number' },
{ type: 'string' }
],
type: 'union'
},
SimpleUnion: {

@@ -175,0 +190,0 @@ additionalProperties: true,

@@ -173,2 +173,21 @@ 'use strict'

},
ObjectInTypeArray: {
type: [{ type: 'object' }]
},
ArrayInTypeArray: {
type: [{ type: 'array' }]
},
UnionInTypeArray: {
type: [{
anyOf: [
{
type: 'number'
},
{
type: 'string'
}
],
type: 'union'
}]
},
SimpleUnion: {

@@ -175,0 +194,0 @@ properties: {

@@ -87,2 +87,11 @@ 'use strict'

},
ObjectInTypeArray: {
type: ['object']
},
ArrayInTypeArray: {
type: ['array']
},
UnionInTypeArray: {
type: ['number | string']
},
SimpleUnion: {

@@ -89,0 +98,0 @@ properties: {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc