Comparing version 0.0.1 to 1.0.0
{ | ||
"name": "fsify", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"authors": [ | ||
@@ -39,6 +39,10 @@ "Tobias Reich <tobias@electerious.com>" | ||
"chai": "^3.5.0", | ||
"coveralls": "^2.11.9", | ||
"istanbul": "^0.4.4", | ||
"mocha": "^3.0.0" | ||
"coveralls": "^2.11.16", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^3.2.0" | ||
}, | ||
"dependencies": { | ||
"is-plain-obj": "^1.1.0", | ||
"pify": "^2.3.0" | ||
} | ||
} |
'use strict' | ||
/* | ||
const path = require('path') | ||
const isPlainObj = require('is-plain-obj') | ||
const parseStructure = require('./parseStructure') | ||
const writeStructure = require('./writeStructure') | ||
/** | ||
* Converts an object into a persistent or temporary directory structure. | ||
* @public | ||
* @param {?Array} structure - Array of objects containing information about a directory or file. | ||
* @param {?Object} opts - Optional options. | ||
* @returns {Promise} Returns the following properties if resolved: {Object}. | ||
*/ | ||
module.exports = function() { | ||
module.exports = function(structure = [], opts = {}) { | ||
} | ||
return new Promise((resolve, reject) => { | ||
if (Array.isArray(structure)===false) { | ||
throw new Error(`'structure' must be an array`) | ||
} | ||
if (isPlainObj(opts)===false && opts!=null) { | ||
throw new Error(`'opts' must be an object, null or undefined`) | ||
} | ||
opts = Object.assign({ | ||
cwd: process.cwd() | ||
}, opts) | ||
// Support relative and absolute paths | ||
opts.cwd = path.resolve(process.cwd(), opts.cwd) | ||
parseStructure(structure, opts.cwd) | ||
.then((parsedStructure) => writeStructure(parsedStructure)) | ||
.then(resolve, reject) | ||
}) | ||
} | ||
/** | ||
* Constants for the structure. | ||
* We don't use symbols for the constants as it should still be possible | ||
* to copy, paste and use the JSON output of `tree`. | ||
* @public | ||
*/ | ||
module.exports.DIRECTORY = 'directory' | ||
module.exports.FILE = 'file' |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9923
13
217
0
2
2
+ Addedis-plain-obj@^1.1.0
+ Addedpify@^2.3.0
+ Addedis-plain-obj@1.1.0(transitive)
+ Addedpify@2.3.0(transitive)