Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

tern-outline

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tern-outline

A Tern plugin for outline.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

tern-outline

Build Status NPM version

Usage

tern-outline is a tern plugin which can be used to display the outline of a JavaScript file.

Editors / IDE

CodeMirror

Eclipse

Tern Explorer View is filled with tern-outline :

Tern Explorer View

Other editors

Takes a sample :

var arr = ["string"];

var n1 = 10;
n1 = "";

function sum(x1, x2) {
	var tmp = x1 * x2;
	return tmp;
}

var n2 = arr;

If you wish to integrate the tern lint with an editor (Vim, Sublime, etc), here the JSON request to post to the tern server :

{
  "query": {
    "type": "outline",
    "file": "b.js"
  },
  "files": [
    {
      "name": "b.js",
      "text": "var arr = [\"string\"];\r\n\r\nvar n1 = 10;\r\nn1 = \"\";\r\n\r\nfunction sum(x1, x2) {\r\n\tvar tmp = x1 * x2;\r\n\treturn tmp;\r\n}\r\n\r\nvar n2 = arr;",
      "type": "full"
    }
  ]
}

and the JSON response of the tern server :

{
  "outline": [
    {
      "name": "arr",
      "type": "[string]",
      "start": 4,
      "end": 7
    },
    {
      "name": "n1",
      "type": "number|string",
      "start": 29,
      "end": 31
    },
    {
      "name": "sum",
      "type": "fn(x1: ?, x2: ?) -> number",
      "start": 51,
      "end": 111,
      "children": [
        {
          "name": "tmp",
          "type": "number",
          "start": 80,
          "end": 83
        }
      ]
    },
    {
      "name": "n2",
      "type": "[string]",
      "start": 119,
      "end": 121
    }
  ]
}

Keywords

tern

FAQs

Package last updated on 04 Dec 2015

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