UNPKG

php.js

Version:

Use phpjs functions as required.

18 lines (16 loc) 822 B
module.exports=function(){ return json_last_error.apply(exports,arguments) }; function json_last_error() { // discuss at: http://phpjs.org/functions/json_last_error/ // original by: Brett Zamir (http://brett-zamir.me) // example 1: json_last_error(); // returns 1: 0 /* JSON_ERROR_NONE = 0 JSON_ERROR_DEPTH = 1 // max depth limit to be removed per PHP comments in json.c (not possible in JS?) JSON_ERROR_STATE_MISMATCH = 2 // internal use? also not documented JSON_ERROR_CTRL_CHAR = 3 // [\u0000-\u0008\u000B-\u000C\u000E-\u001F] if used directly within json_decode(), // but JSON functions auto-escape these, so error not possible in JavaScript JSON_ERROR_SYNTAX = 4 */ return this.php_js && this.php_js.last_error_json ? this.php_js.last_error_json : 0; }