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

jason-formatter

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jason-formatter - npm Package Compare versions

Comparing version 1.0.1 to 1.1.1

.eslintrc.js

15

package.json
{
"name": "jason-formatter",
"version": "1.0.1",
"version": "1.1.1",
"description": "A Command Line tool to format JSON",

@@ -25,3 +25,14 @@ "main": "src/index.js",

},
"homepage": "https://github.com/UltiRequiem/json-formatter#readme"
"homepage": "https://github.com/UltiRequiem/json-formatter#readme",
"devDependencies": {
"eslint": "^7.31.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin": "^1.0.1",
"eslint-plugin-import": "^2.23.4",
"prettier": "^2.3.2",
"eslint-plugin-prettier": "^3.4.0",
"prettier-eslint": "^12.0.0",
"prettier-plugin-jsdoc": "^0.3.23"
}
}

6

README.md
# Jason
A command line tool to format JSON.
A Command Line tformatter for JSON files, zero dependencies.

@@ -25,8 +25,8 @@ ![Cover](./assets/cover.png)

// Good Old require
const { format } = require("jason-formatter");
const { format } = require('jason-formatter');
// New Syntax
import { format } from "jason-formatter";
import { format } from 'jason-formatter';
```
You can see an example of use in [test/formatter.js](./tests/formater.js).

@@ -1,3 +0,7 @@

const fs = require("fs").promises;
const fs = require('fs').promises;
/**
* @param {string} text
* @returns {string} The formatted text
*/
function format(text) {

@@ -7,9 +11,11 @@ return JSON.stringify(JSON.parse(text), null, 4);

/** @param {string} file */
async function writeFile(file) {
if (!file) throw new Error("You have to pass a file!");
if (!file) throw new Error('You have to pass a file!');
const raw = await fs.readFile(file, "utf-8");
fs.writeFile(file, format(raw)).then(() => console.log("JSON Formated :)"));
const raw = await fs.readFile(file, 'utf-8');
fs.writeFile(file, format(raw)).then(() => console.log('JSON Formated :)'));
}
/** Init Function: Start the process */
function init() {

@@ -19,2 +25,3 @@ writeFile(process.argv[2]);

// Export Init and format function.
module.exports = { init, format };

@@ -12,2 +12,1 @@ {

}

@@ -1,2 +0,2 @@

const { format } = require("../src/index");
const { format } = require('../src/index');

@@ -3,0 +3,0 @@ const rawData = `

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