New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-jq

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-jq - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2-rc1

README.md

4

lib/jq.js

@@ -17,3 +17,3 @@ 'use strict';

var createJqCommand = function createJqCommand(filter, json) {
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

@@ -29,3 +29,3 @@ var command = {

var run = exports.run = function run(filter, json) {
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

@@ -32,0 +32,0 @@ return new Promise(function (resolve, reject) {

@@ -40,3 +40,3 @@ 'use strict';

var mergeOptionDefaults = function mergeOptionDefaults() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -51,3 +51,3 @@ Object.keys(optionDefaults).forEach(function (key) {

var parseOptions = exports.parseOptions = function parseOptions(filter, json) {
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

@@ -54,0 +54,0 @@ mergeOptionDefaults(options);

{
"name": "node-jq",
"version": "0.2.1",
"version": "0.2.2-rc1",
"description": "Run jq in node",

@@ -5,0 +5,0 @@ "main": "lib/jq.js",

@@ -76,5 +76,37 @@ #!/usr/bin/env node

/**
* Finds the pathname of the parent module's package descriptor file. If the
* directory is undefined (the default case), then it is set to the directory
* name of the parent module's filename. If no package.json file is found, then
* the parent directories are recursively searched until the file is found or
* the root directory is reached. Returns the pathname if found or null if not.
*/
function findParentPackage (directory) {
if (!directory) {
directory = path.dirname(module.parent.filename)
}
const file = path.resolve(directory, 'package.json')
if (fs.existsSync(file) && fs.statSync(file).isFile()) {
return file
}
const parent = path.resolve(directory, '..')
if (parent === directory) {
return null
}
return findParentPackage(parent)
}
function saveAndRenameToJq (data) {
console.log('Done!')
return fs.writeFile(BINARY_PATH + 'jq', data, { mode: 0o777, encoding: 'binary' })
let binaryPath
try {
binaryPath = findParentPackage()
} catch (e) {
binaryPath = BINARY_PATH
}
return fs.writeFile(binaryPath + 'jq', data, { mode: 0o777, encoding: 'binary' })
}

@@ -81,0 +113,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