Хочу такую СУБД, в которой можно искать регулярками!!!
и делать нечеткий поиск по документу
Бесплатных лимитов хватает только на самообучение, да примитивнейшие проекты.
console.log(/abc/.test("abcde")); // → true
console.log(/abc/.test("abxde")); // → false
var doc = DocumentApp.openById('id документа');
var textToHighlight = 'текст для подсветки';
var highlightStyle = {};
highlightStyle[DocumentApp.Attribute.FOREGROUND_COLOR] = '#FF0000';
var paras = doc.getParagraphs();
var textLocation = {};
for (i=0; i<paras.length; ++i)
{
textLocation = paras[i].findText(textToHighlight);
if (textLocation != null && textLocation.getStartOffset() != -1)
{
textLocation.getElement().setAttributes(textLocation.getStartOffset(),textLocation.getEndOffsetInclusive(), highlightStyle);
}
}
function Foo(x){
var res = function(a,b){
//do something
return a+b;
};
res.bar = x; //some prop
res.add = function(a){return res.bar+=a} //some method
res.quad = function(){return (res.bar*res.bar)} //other method
return res; //return function with custom prop&methods
};
var foo = new Foo(1);
console.log(foo.bar); //1
console.log(foo.add(2)); //3
console.log(foo.bar); //3
console.log(foo.quad()); //9
console.log(foo.bar); //3
console.log(foo(8,10)); //18 call like function