1.0.4 • Published 4 years ago
langscript v1.0.4
LangScript
LangScript is a NodeJS Plugin for making Programming Languages thanks to pre-created functions
Summary
Functions
isString() :
parameters :
- string string
verify if the string contains a string
isChar() :
parameters :
- string string
verify if the string is contains only one letter
isNumber
parameters :
verify if it contains a number
isDouble
parameters :
- number number
verify if it contains a decimal number with a number after the comma
isFloat
parameters :
- number number
verify if it contains a decimal number
isFloat
parameters :
- number number
verify if it contains a decimal number
getLinePos
parameters :
get Position of the line in the code
getKeyPos
parameters :
get Position of the key in the line
getTextInString() :
parameters :
- string string
get text in the string
isChar() :
parameters :
- string string
verify if the string is contains only one letter
Examples
const langscript = require("langscript");
let code = 'print "hello"';
langscript.getKeyPos("print", code).then((k) => {
let words = langscript.splitToWords(code);
let nextKey = words[k.position + 1];
if (langscript.isString(nextKey)) {
let text = langscript.getTextInString(nextKey);
console.log(text);
} else if (langscript.isNumber(nextKey)) {
console.log(nextKey);
}
});
Installation
npm i langscript