tfk-dsf-unwrap-contact
Advanced tools
Comparing version 1.0.2 to 1.0.3
'use strict' | ||
var repackContact = require('./lib/repack-contact') | ||
const repackContact = require('./lib/repack-contact') | ||
@@ -9,4 +9,7 @@ function unwrapContact (contact) { | ||
} | ||
const templatePath = contact.templatePath || '' | ||
if (contact.RESULT && contact.RESULT.HOV) { | ||
return repackContact(contact.RESULT.HOV) | ||
return repackContact(contact.RESULT.HOV, templatePath) | ||
} else { | ||
@@ -13,0 +16,0 @@ throw new Error('Malformed contact object') |
'use strict' | ||
var fs = require('fs') | ||
var path = require('path') | ||
function repackContact (data) { | ||
function repackContact (data, filePath) { | ||
if (!data) { | ||
throw new Error('Missing required input: data object') | ||
} | ||
var template = require('./data/template.json') | ||
const templatePath = path.resolve(filePath || 'lib/data/template.json') | ||
if (fs.existsSync(templatePath)) { | ||
var template = require(templatePath) | ||
} else { | ||
throw new Error('File does not exist: ' + templatePath) | ||
} | ||
@@ -9,0 +16,0 @@ Object.keys(template).forEach(function (key) { |
{ | ||
"name": "tfk-dsf-unwrap-contact", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Unwraps contact information from dsf result", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -105,2 +105,3 @@ [](https://travis-ci.org/telemark/tfk-dsf-unwrap-contact) | ||
data.templatePath = 'lib/data/skoleskyss.json' // To use another template | ||
@@ -132,2 +133,2 @@ console.log(unwrapContact(data)) | ||
## License | ||
[MIT](LICENSE) | ||
[MIT](LICENSE) |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
13523
17
341
133
2
1