7z-iterator
Advanced tools
@@ -240,28 +240,9 @@ /** | ||
| if (this.parsed) { | ||
| if (typeof callback === 'function') { | ||
| callback(null); | ||
| return; | ||
| } | ||
| if (typeof Promise === 'undefined') { | ||
| return; | ||
| } | ||
| if (typeof callback === 'function') return callback(null); | ||
| return Promise.resolve(); | ||
| } | ||
| var executor = function(done) { | ||
| _this.parseInternal(done); | ||
| }; | ||
| if (typeof callback === 'function') { | ||
| executor(callback); | ||
| return; | ||
| } | ||
| if (typeof Promise === 'undefined') { | ||
| throw new Error('Promises are not available in this runtime. Please provide a callback to parse().'); | ||
| } | ||
| if (typeof callback === 'function') return this.parseInternal(callback); | ||
| return new Promise(function(resolve, reject) { | ||
| executor(function(err) { | ||
| if (err) { | ||
| reject(err); | ||
| return; | ||
| } | ||
| resolve(); | ||
| return _this.parseInternal(function(err) { | ||
| return err ? reject(err) : resolve(); | ||
| }); | ||
@@ -268,0 +249,0 @@ }); |
@@ -56,30 +56,7 @@ /** | ||
| if (this.parsed) { | ||
| if (typeof callback === 'function') { | ||
| callback(null); | ||
| return; | ||
| } | ||
| if (typeof Promise === 'undefined') { | ||
| return; | ||
| } | ||
| if (typeof callback === 'function') return callback(null); | ||
| return Promise.resolve(); | ||
| } | ||
| const executor = (done)=>{ | ||
| this.parseInternal(done); | ||
| }; | ||
| if (typeof callback === 'function') { | ||
| executor(callback); | ||
| return; | ||
| } | ||
| if (typeof Promise === 'undefined') { | ||
| throw new Error('Promises are not available in this runtime. Please provide a callback to parse().'); | ||
| } | ||
| return new Promise((resolve, reject)=>{ | ||
| executor((err)=>{ | ||
| if (err) { | ||
| reject(err); | ||
| return; | ||
| } | ||
| resolve(); | ||
| }); | ||
| }); | ||
| if (typeof callback === 'function') return this.parseInternal(callback); | ||
| return new Promise((resolve, reject)=>this.parseInternal((err)=>err ? reject(err) : resolve())); | ||
| } | ||
@@ -86,0 +63,0 @@ parseInternal(callback) { |
+1
-1
| { | ||
| "name": "7z-iterator", | ||
| "version": "2.2.3", | ||
| "version": "2.2.4", | ||
| "description": "Extract contents from 7z archives using an iterator API. Pure JavaScript, works on Node.js 0.8+", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
907280
-0.25%9881
-0.42%