graphology-gexf
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -36,2 +36,2 @@ /** | ||
return value; | ||
} | ||
}; |
@@ -24,12 +24,12 @@ /** | ||
var VALID_GEXF_TYPES = new Set([ | ||
'integer', | ||
'long', | ||
'double', | ||
'float', | ||
'boolean', | ||
'liststring', | ||
'string', | ||
'anyURI' | ||
]); | ||
// var VALID_GEXF_TYPES = new Set([ | ||
// 'integer', | ||
// 'long', | ||
// 'double', | ||
// 'float', | ||
// 'boolean', | ||
// 'liststring', | ||
// 'string', | ||
// 'anyURI' | ||
// ]); | ||
@@ -123,4 +123,4 @@ var VIZ_RESERVED_NAMES = new Set([ | ||
const DEFAULT_NODE_REDUCER = DEFAULT_ELEMENT_REDUCER.bind(null, 'node'), | ||
DEFAULT_EDGE_REDUCER = DEFAULT_ELEMENT_REDUCER.bind(null, 'edge'); | ||
var DEFAULT_NODE_REDUCER = DEFAULT_ELEMENT_REDUCER.bind(null, 'node'), | ||
DEFAULT_EDGE_REDUCER = DEFAULT_ELEMENT_REDUCER.bind(null, 'edge'); | ||
@@ -169,2 +169,15 @@ /** | ||
/** | ||
* Function used to cast the given value into the given type. | ||
* | ||
* @param {string} type - Target type. | ||
* @param {any} value - Value to cast. | ||
* @return {string} | ||
*/ | ||
function cast(type, value) { | ||
if (type === 'liststring' && Array.isArray(value)) | ||
return value.join('|'); | ||
return '' + value; | ||
} | ||
/** | ||
* Function used to collect data from a graph's nodes. | ||
@@ -388,15 +401,2 @@ * | ||
/** | ||
* Function used to cast the given value into the given type. | ||
* | ||
* @param {string} type - Target type. | ||
* @param {any} value - Value to cast. | ||
* @return {string} | ||
*/ | ||
function cast(type, value) { | ||
if (type === 'liststring' && Array.isArray(value)) | ||
return value.join('|'); | ||
return '' + value; | ||
} | ||
/** | ||
* Function taking a graphology instance & outputting a gexf string. | ||
@@ -410,3 +410,3 @@ * | ||
*/ | ||
module.exports = function writer(graph, options) { | ||
module.exports = function write(graph, options) { | ||
if (!isGraph(graph)) | ||
@@ -436,3 +436,3 @@ throw new Error('graphology-gexf/writer: invalid graphology instance.'); | ||
for (k in graphAttributes) { | ||
for (var k in graphAttributes) { | ||
if (k !== 'lastModifiedDate') | ||
@@ -439,0 +439,0 @@ writer.writeElement(k, graphAttributes[k]); |
{ | ||
"name": "graphology-gexf", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "GEXF parser & writer for graphology.", | ||
@@ -13,3 +13,3 @@ "main": "index.js", | ||
"scripts": { | ||
"lint": "eslint *.js browser/**/*.js node/**/*.js", | ||
"lint": "eslint ./**/*.js", | ||
"test:browser": "mocha ./test/browser/endpoint.js", | ||
@@ -44,3 +44,6 @@ "test": "npm run test:browser" | ||
"eslintConfig": { | ||
"extends": "@yomguithereal/eslint-config" | ||
"extends": "@yomguithereal/eslint-config", | ||
"globals": { | ||
"Set": true | ||
} | ||
}, | ||
@@ -47,0 +50,0 @@ "dependencies": { |
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
24886