graphology-gexf
Advanced tools
Comparing version 0.12.0 to 0.12.1
@@ -130,8 +130,13 @@ /* eslint no-self-compare: 0 */ | ||
var TYPE_PRIORITIES = { | ||
string: 0, | ||
boolean: 1, | ||
integer: 2, | ||
long: 3, | ||
double: 4, | ||
empty: 5 | ||
liststring: 0, | ||
listdouble: 1, | ||
listlong: 2, | ||
listinteger: 3, | ||
listboolean: 4, | ||
string: 5, | ||
double: 6, | ||
long: 7, | ||
integer: 8, | ||
boolean: 9, | ||
empty: 10 | ||
}; | ||
@@ -188,3 +193,7 @@ | ||
if (Array.isArray(value)) { | ||
return 'list' + inferListValueType(value); | ||
var type = inferListValueType(value); | ||
if (type === 'empty') return 'empty'; | ||
return 'list' + type; | ||
} | ||
@@ -223,3 +232,5 @@ | ||
function cast(version, type, value) { | ||
if (type.startsWith('list') && Array.isArray(value)) { | ||
if (type.startsWith('list')) { | ||
value = Array.isArray(value) ? value : [value]; | ||
var subtype = type.slice(4); | ||
@@ -306,3 +317,3 @@ if (version === '1.3') { | ||
var attributes; | ||
var type; | ||
var type, currentType; | ||
var k; | ||
@@ -321,5 +332,10 @@ | ||
if (!model[k]) model[k] = type; | ||
currentType = model[k]; | ||
if (!currentType) model[k] = type; | ||
else { | ||
if (TYPE_PRIORITIES[type] < TYPE_PRIORITIES[model[k]]) { | ||
if ( | ||
type !== currentType && | ||
TYPE_PRIORITIES[type] < TYPE_PRIORITIES[currentType] | ||
) { | ||
model[k] = type; | ||
@@ -326,0 +342,0 @@ } |
{ | ||
"name": "graphology-gexf", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"description": "GEXF parser & writer for graphology.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -109,3 +109,3 @@ [![Build Status](https://github.com/graphology/graphology-gexf/workflows/Tests/badge.svg)](https://github.com/graphology/graphology-gexf/actions) | ||
- **pretty** _?boolean_ [`true`]: pretty-print output? | ||
- **pedantic** _?boolean_ [`false`]: whether to output a stricter gexf file to make sure it can be validated using the most restrictive gexf xsv schemas. Note that the output may lose some graph attributes when doing so. | ||
- **pedantic** _?boolean_ [`false`]: whether to output a stricter gexf file to make sure it can be validated using the most restrictive gexf xsd schemas. Note that the output may lose some graph attributes when doing so. | ||
- **version** _?string_ [`1.2`]: gexf version to emit. Should be one of `1.2` or `1.3`. | ||
@@ -112,0 +112,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39603
1117