Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sander

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sander - npm Package Compare versions

Comparing version 0.3.8 to 0.4.0

dist/sander.cjs.js

6

package.json

@@ -5,3 +5,3 @@ {

"author": "Rich Harris",
"version": "0.3.8",
"version": "0.4.0",
"license": "MIT",

@@ -15,4 +15,4 @@ "repository": "https://github.com/rich-harris/sander",

},
"main": "dist/sander.js",
"jsnext:main": "src/sander.js",
"main": "dist/sander.cjs.js",
"jsnext:main": "dist/sander.es6.js",
"devDependencies": {

@@ -19,0 +19,0 @@ "buffer-crc32": "^0.2.3",

@@ -1,58 +0,47 @@

import * as fs from 'graceful-fs';
import { sep } from 'path';
import * as fs from 'fs';
import { resolve, sep } from 'path';
import resolvePath from '../utils/resolvePath';
export function lsr () {
const basedir = resolvePath( arguments );
function walk ( dir, callback ) {
let results = [];
let result = [];
fs.readdir( dir, ( err, files ) => {
if ( err ) return callback( err );
function processdir ( dir, cb ) {
fs.readdir( dir, ( err, files ) => {
if ( err ) {
return cb( err );
}
let pending = files.length;
if ( !pending ) return callback( null, results );
let remaining = files.length;
files.forEach( file => {
file = resolve( dir, file );
if ( !remaining ) {
return cb();
}
files = files.map( file => dir + sep + file );
function check ( err ) {
if ( err ) {
cb( err );
fs.stat( file, ( err, stats ) => {
if ( stats && stats.isDirectory() ) {
walk( file, ( err, res ) => {
results = results.concat( res );
if ( !--pending ) callback( null, results );
});
} else {
results.push( file );
if ( !--pending ) callback( null, results );
}
else if ( !--remaining ) {
cb();
}
}
files.forEach( file => {
fs.stat( file, ( err, stats ) => {
if ( err ) {
cb( err );
} else {
if ( stats.isDirectory() ) {
processdir( file, check );
} else {
result.push( file.replace( basedir + sep, '' ) );
check();
}
}
});
});
});
}
});
};
export function lsr () {
const basedir = resolvePath( arguments );
return new Promise( ( fulfil, reject ) => {
processdir( basedir, err => {
if ( err ) {
reject( err );
} else {
fulfil( result );
walk( basedir, function ( err, result ) {
if ( err ) return reject( err );
// files should be relative to basedir
const index = basedir.length + 1;
let i = result.length;
while ( i-- ) {
result[i] = result[i].substring( index );
}
fulfil( result );
});

@@ -59,0 +48,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc