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

jsoner

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsoner - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

10

lib/append.js

@@ -71,2 +71,12 @@ var fs = require('fs');

*/
try {
fs.accessSync(filename, fs.R_OK | fs.W_OK);
} catch (err) {
if (err.toString().match(/ENOENT/)) {
fs.writeFileSync(filename, '[]');
} else {
throw err;
}
}

@@ -73,0 +83,0 @@ var fd = fs.openSync(filename, 'r+');

2

package.json
{
"name": "jsoner",
"version": "0.1.2",
"version": "0.1.3",
"description": "Simple, fast, minimalist JSON library for node",

@@ -5,0 +5,0 @@ "keywords": [

@@ -24,7 +24,2 @@ var _ = require('lodash');

describe('.appendFileSync', function() {
it('fails to append to a file in an inexistent file', function() {
expect(function() {
jsoner.appendFileSync(tmpFilename, {});
}).to.throw(/ENOENT. no such file or directory/);
});

@@ -44,2 +39,11 @@ it('fails to append to a file in an inexistent path', function() {

it('appends to a inexistent file', function() {
var newFilename = tmp.tmpNameSync();
var object = { foo: 'bar' };
jsoner.appendFileSync(newFilename, object);
var data = fs.readFileSync(newFilename);
expect(JSON.parse(data.toString())).to.deep.equal([object]);
fs.unlinkSync(newFilename);
});
it('appends a JSON object to an empty file', function() {

@@ -122,3 +126,4 @@ var object = { foo: 'bar' };

});
});
});
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