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

monocart-code-viewer

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monocart-code-viewer

Monocart Code Viewer

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

monocart-code-viewer

Feature

  • Base on CodeMirror
  • Coverage View

Install

npm i monocart-code-viewer

Usage

import { createCodeViewer } from 'monocart-code-viewer';

let codeViewer;

const report = {
    content: "your source content",
    coverage: {
        uncoveredLines: {
            '0': 'comment',
            '1': 'blank',
            '8': 'partial',
            '9': 'uncovered'
        },
        uncoveredPieces: {
            '8': [
                {
                    'start': 27,
                    'end': 34
                }
            ]
        },
        decorations: {
            '14': [
                {
                    'column': 4,
                    'value': 'E',
                    'attrs': {
                        'title': 'else path uncovered'
                    }
                }
            ]
        },
        executionCounts: {
            '20': [
                {
                    'column': 22,
                    'count': 10,
                    'value': '10',
                    'end': 916
                }
            ]
        }
    }
};

if (codeViewer) {
    codeViewer.update(report);
} else {
    codeViewer = createCodeViewer($el, report);
    codeViewer.on('cursor', (loc) => {
        // console.log('cursor', loc);
    });

    // codeViewer.setSelection(start, end, options);
    // codeViewer.setCursor(pos, options);
}

FAQs

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