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

redeyed

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redeyed

Takes JavaScript code, along with a config and returns the original code with tokens wrapped as configured.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-30.15%
Maintainers
1
Weekly downloads
 
Created

What is redeyed?

The redeyed npm package provides functionality for syntax highlighting and code transformation by allowing modifications to JavaScript code through configuration of hooks for tokens and types. It enables parsing JavaScript code, identifying tokens and their types, and then applying transformations or highlighting based on the configuration provided.

What are redeyed's main functionalities?

Syntax Highlighting

This feature allows for syntax highlighting of JavaScript code. By configuring the `String` token, all string literals in the code can be highlighted. The example demonstrates how to highlight string literals in green using ANSI escape codes.

const redeyed = require('redeyed');
const config = {
  String: {
    _default: { open: '\x1b[32m', close: '\x1b[39m', _default: true }
  }
};
const code = '"Hello, world!"';
const highlighted = redeyed(code, config).code;
console.log(highlighted);

Code Transformation

This feature enables code transformation by applying custom transformations to specific JavaScript tokens. In the example, all instances of the `function` keyword are prefixed with `_function_`, demonstrating a simple transformation.

const redeyed = require('redeyed');
const config = {
  Keyword: {
    'function': { open: '_function_', close: '' }
  }
};
const code = 'function example() {}';
const transformed = redeyed(code, config).code;
console.log(transformed);

Other packages similar to redeyed

Keywords

FAQs

Package last updated on 25 Aug 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