PHP Classes

File: FrontEndScripts/libs/codemirror/addon/lint/json-lint.js

Recommend this page to a friend!
  Classes of Aleksey Nemiro  >  PHP Small Server Administrator  >  FrontEndScripts/libs/codemirror/addon/lint/json-lint.js  >  Download  
File: FrontEndScripts/libs/codemirror/addon/lint/json-lint.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Small Server Administrator
Web panel for small Debian and Ubuntu servers
Author: By
Last change:
Date: 6 years ago
Size: 954 bytes


Class file image Download
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license:

// Depends on jsonlint.js from

// declare global: jsonlint

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
  else if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror"], mod);
  else // Plain browser env
})(function(CodeMirror) {
"use strict";

CodeMirror.registerHelper("lint", "json", function(text) {
  var found = [];
  jsonlint.parseError = function(str, hash) {
    var loc = hash.loc;
    found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
                to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
                message: str});
  try { jsonlint.parse(text); }
  catch(e) {}
  return found;

For more information send a message to info at phpclasses dot org.