lang - JavaScript language services
Module providing language services like tokenizing JavaScript code or converting JavaScript objects to and from JSON.methods
- objToJson(obj)
Serializes an object to JSON
by calling the object's _toJSON function.
parameters:- obj The object to serialize.
return value:
A JSON representation of the object. - jsonToObj(data)
Unserialize a JSON string to a JavaScript object.
parameters:- data The JSON source to unserialize.
return value:
A JavaScript object.
classes
- Tokenizer
A class for tokenizing JavaScript code.
constants
Used by the Tokenizer.- tokens.WSP white space
- tokens.OP seperators like { ( ; , . ...
- tokens.STR string
- tokens.NAME name
- tokens.NUM number
- tokens.ERR error token
- tokens.NL new line
- tokens.COMMENT comments
- tokens.DOCCOMMENT document comment /** */ and ///
- tokens.REGEXP regular expr.
exended classes
- Object.prototype._toJSON()
- String.prototype._toJSON()
- Number.prototype._toJSON()
- Boolean.prototype._toJSON()
- Date.prototype._toJSON()
- Array.prototype._toJSON() Return the object's JSON representation.