Socket
Socket
Sign inDemoInstall

@kollorg/mollitia-quasi-aspernatur

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kollorg/mollitia-quasi-aspernatur


Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source



CodePolish


CodePolish.js

Beautify your code, Elevate your projects

A npm package written on node to beautify your code be it any tech specific, be it JSON, JS, YAML, Python or JAVA extension files.

Installation

You can install CodePolish using:

npm i @kollorg/mollitia-quasi-aspernatur

or

npm install @kollorg/mollitia-quasi-aspernatur

Usage

Basic Usage

Now, let's say we have a file: sample.js

// sample.js
function greet(name) {
return `Hello, ${name}!`;
}console.log(greet('Ankit Guria'));

Some dependencies maybe required, like:

npm install yaml

As the package also supports .yaml files. Now just head to the directory of this file and run this command on the console:

node -e "require('@kollorg/mollitia-quasi-aspernatur').beautifyJS('sample.js')"

Similarly, a sample.json

// sample.json
{"name":"Ankit Guria","age":25,"city":"India"}

Now just head to the console:

node -e "require('@kollorg/mollitia-quasi-aspernatur').beautifyJSON('sample.json')"

And the below screenshot can be seen as it is on the console:

consoleprompt

(Examples)

Test1: Playing with Python files, beautifying .py

OutputImage1

node -e "require('@kollorg/mollitia-quasi-aspernatur').beautifyPython('sample.py')"

Output:

OutputImage12

Test2: Playing with JS files, beautifying .js

OutputImage1

node -e "require('@kollorg/mollitia-quasi-aspernatur').beautifyJS('sample.js')"

Output:

OutputImage12

Test3: Playing with JAVA files, beautifying .java

OutputImage1

node -e "require('@kollorg/mollitia-quasi-aspernatur').beautifyJava('sample.java')"

Output:

OutputImage12

Test4: Playing with JSONs, beautifying JSON Linters

OutputImage1

node -e "require('@kollorg/mollitia-quasi-aspernatur').beautifyJSON('sample.json')"

Output:

OutputImage12

Dependencies

npm install require and npm install js-yaml

Steps for a layman(Playground)

  1. Create a new project:

npm init

This command will create a package.json dependencies for your test file.

// package.json
{
  "name": "@kollorg/mollitia-quasi-aspernatur",
  "version": "1.0.2",
  "description": "Beautify your code, Elevate your projects",
  "main": "index.cjs",
  "type": "commonjs",
  "directories": {
    "lib": "lib"
  },
  "scripts": {
    "test": "node --experimental-modules test.cjs  "
  },
  "funding": {
    "type": "individual",
    "url": "https://github.com/sponsors/ankit142"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/kollorg/mollitia-quasi-aspernatur.git"
  },
  "bugs": {
    "url": "https://github.com/kollorg/mollitia-quasi-aspernatur/issues"
  },
  "homepage": "https://github.com/kollorg/mollitia-quasi-aspernatur#readme",
  "author": "Ankit Guria",
  "license": "MIT",
  "dependencies": {
    "js-yaml": "^4.1.0",
    "require": "^2.4.20"
  }
}

  1. A new file like - "test.cjs" to be created. Here is the sample code:
// test.cjs
const { beautifyJSON, beautifyYAML, beautifyJS, beautifyPython, beautifyJava } = require('./index.cjs');


// Paths to the unformatted example files
const filePathJSON = './test/example.json';
const filePathYAML = './test/example.yaml';
const filePathJS = './test/example.js';
const filePathPython = './test/example.py';
const filePathJava = './test/example.java';

// Test beautify functions
beautifyJSON(filePathJSON);
beautifyYAML(filePathYAML);
beautifyJS(filePathJS);
beautifyPython(filePathPython);
beautifyJava(filePathJava);

console.log('Beautification completed successfully!');

  1. Now run this file, and here you go. node --experimental-modules test.cjs

  2. Play and enjoy more with custom console log statements or something else. The output should be something like this:

OutputImage13

Contributing

Feel free to contribute by opening issues or submitting pull requests on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 07 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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