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

clang-format

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clang-format - npm Package Compare versions

Comparing version 1.0.34 to 1.0.35

53

index.js

@@ -9,2 +9,4 @@ #!/usr/bin/env node

var spawn = require('child_process').spawn;
var glob = require("glob");
var async = require("async");

@@ -52,7 +54,48 @@ var VERSION = require('./package.json').version;

}
var clangFormatProcess = spawn(nativeBinary, args, {stdio: stdio});
clangFormatProcess.on('close', function(exit) {
if (exit) done(exit);
});
return clangFormatProcess;
// extract glob, if present
var filesGlob = args.filter(function(arg){return arg.indexOf('--glob=') === 0;})
.map(function(arg){return arg.replace('--glob=', '');})
.shift();
if (filesGlob) {
// remove glob from arg list
args = args.filter(function(arg){return arg.indexOf('--glob=') === -1;});
return glob(filesGlob, function(er, files) {
// split file array into chunks of 30
var i,j, chunks = [], chunkSize = 30;
for (i=0,j=files.length; i<j; i+=chunkSize) {
chunks.push( files.slice(i,i+chunkSize));
}
// launch a new process for each chunk
async.series(
chunks.map(function(chunk) {
return function(callback) {
var clangFormatProcess = spawn(nativeBinary,
args.concat(chunk),
{stdio: stdio});
clangFormatProcess.on('close', function(exit) {
if (exit !== 0) callback(exit);
else callback(null, exit);
});
};
}),
function(err, results) {
if (err) done(err);
console.log('\n');
console.log('ran clang-format on',
files.length,
files.length === 1 ? 'file' : 'files');
done(results.shift() || 0);
});
});
} else {
var clangFormatProcess = spawn(nativeBinary, args, {stdio: stdio});
clangFormatProcess.on('close', function(exit) {
if (exit) done(exit);
});
return clangFormatProcess;
}
}

@@ -59,0 +102,0 @@

7

package.json
{
"name": "clang-format",
"version": "1.0.34",
"version": "1.0.35",
"description": "node wrapper around clang-format",

@@ -19,8 +19,11 @@ "repository": {

"Alex Eagle <alexeagle@google.com>",
"Martin Probst <martinprobst@google.com>"
"Martin Probst <martinprobst@google.com>",
"Filipe Silva <filipematossilva@gmail.com>"
],
"license": "Apache-2.0",
"dependencies": {
"async": "^1.5.2",
"glob": "^7.0.0",
"resolve": "^1.1.6"
}
}

@@ -13,2 +13,10 @@ # clang-format

## Globbing files
$ clang-format --glob=folder/**/*.js
This will run `clang-format` once per file result, and show the total
formatted files at the end.
See [node-glob](https://github.com/isaacs/node-glob) for globbing semantics.
## Compiling clang-format

@@ -15,0 +23,0 @@

Sorry, the diff of this file is not supported yet

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