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

alignment

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alignment

Naive alignment of a block with variable assignments

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Alignment

NPM version NPM downloads Build status Test coverage

Alignment does naive alignment of a block with variable assignments.

Installation

npm install alignment --save

Usage

Returns a tuple of the result text and cursor positions.

import { block } from 'alignment'

const result = block(`
var x = 10;
var backgroundImage = 'http://example.com';
`)

console.log(result)
// [
//   '\nvar x               = 10;\nvar backgroundImage = \'http://example.com\';\n',
//   [ [ 1, 20 ], [ 2, 20 ] ]
// ]

Caveats:

  • Currently only supports \n line endings
  • True automatic alignment is difficult to achieve in a language agnostic way
    • Handling alignment across strings
    • Hanlding alignment across comments

License

MIT

Keywords

FAQs

Package last updated on 24 Feb 2016

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