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

eidolon

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eidolon - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

4

Changelog.md

@@ -0,1 +1,5 @@

# 1.2.0 - 2016-02-02
- Add reference information to dereferenced data structures via the `meta.ref` property, which contains a string ID of the reference from which the element is derived. This works for both type references and object mixins/includes.
# 1.1.0 - 2016-02-01

@@ -2,0 +6,0 @@

@@ -8,3 +8,3 @@ // Generated by CoffeeScript 1.10.0

module.exports = dereference = function(root, dataStructures) {
var i, item, member, properties, ref;
var i, item, j, len, member, properties, property, ref, ref1;
switch (root.element) {

@@ -31,4 +31,13 @@ case 'enum':

if (member.element === 'ref') {
i--;
ref = dataStructures[member.content.href];
i--;
ref.content = JSON.parse(JSON.stringify(ref.content));
ref1 = ref.content;
for (j = 0, len = ref1.length; j < len; j++) {
property = ref1[j];
if (property.meta == null) {
property.meta = {};
}
property.meta.ref = member.content.href;
}
properties.splice.apply(properties, [i, 1].concat(ref.content));

@@ -35,0 +44,0 @@ continue;

30

lib/inherit.js

@@ -25,4 +25,8 @@ // Generated by CoffeeScript 1.10.0

module.exports = function(base, element) {
var combined, item, j, key, len, ref, ref1, ref2, ref3, ref4, value;
var combined, item, j, key, len, ref, ref1, ref2, ref3, ref4, ref5, value;
combined = JSON.parse(JSON.stringify(base));
if (((ref = base.meta) != null ? ref.id : void 0) != null) {
delete combined.meta.id;
combined.meta.ref = base.meta.id;
}
if (element.meta) {

@@ -32,6 +36,6 @@ if (combined.meta == null) {

}
ref = element.meta;
for (key in ref) {
if (!hasProp.call(ref, key)) continue;
value = ref[key];
ref1 = element.meta;
for (key in ref1) {
if (!hasProp.call(ref1, key)) continue;
value = ref1[key];
combined.meta[key] = value;

@@ -44,6 +48,6 @@ }

}
ref1 = element.attributes;
for (key in ref1) {
if (!hasProp.call(ref1, key)) continue;
value = ref1[key];
ref2 = element.attributes;
for (key in ref2) {
if (!hasProp.call(ref2, key)) continue;
value = ref2[key];
combined.attributes[key] = value;

@@ -53,9 +57,9 @@ }

if (element.content) {
if (((ref2 = combined.content) != null ? ref2.push : void 0) || ((ref3 = element.content) != null ? ref3.push : void 0)) {
if (((ref3 = combined.content) != null ? ref3.push : void 0) || ((ref4 = element.content) != null ? ref4.push : void 0)) {
if (combined.content == null) {
combined.content = [];
}
ref4 = element.content;
for (j = 0, len = ref4.length; j < len; j++) {
item = ref4[j];
ref5 = element.content;
for (j = 0, len = ref5.length; j < len; j++) {
item = ref5[j];
combined.content.push(item);

@@ -62,0 +66,0 @@ }

{
"name": "eidolon",
"version": "1.1.0",
"version": "1.2.0",
"description": "Generate JSON or JSON Schema from Refract & MSON data structures",

@@ -5,0 +5,0 @@ "main": "lib/eidolon.js",

@@ -163,3 +163,3 @@ # Eidolon

Dereference an input element or structure of elements with the given data structures. This will return the same element or structure with resolved references so you do not have to handle inheritance or object includes.
Dereference an input element or structure of elements with the given data structures. This will return the same element or structure with resolved references so you do not have to handle inheritance or object includes. Each resolved reference will include the name of the referenced type or mixin in the [`meta.ref` property](https://github.com/refractproject/refract-spec/blob/master/refract-spec.md#properties).

@@ -184,4 +184,5 @@ ```js

console.log(dereferenced.element); // => 'string'
console.log(dereferenced.content); // => 'Hello, world!'
console.log(dereferenced.element); // => 'string'
console.log(dereferenced.content); // => 'Hello, world!'
console.log(dereferenced.meta.ref); // => 'MyString'
```

@@ -188,0 +189,0 @@

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