Blog

String.prototype.expandTabs()

I personally love both JavaScript and Python. For this reason, from time to time I like to port functions that are available in Python, over to JavaScript. The following is a port of the expandTabs function. The biggest difference between this JavaScript version and the Python version is the limitation Read more…

By Chris West, ago
Blog

String.protototype.toCharCodes()

One of the functions that didn’t make the cut for jPaq is String.prototype.toCharCodes().  The reason is I don’t feel that it is a function that many people are looking for.  Still, if you are looking for a good implementation for it, you can use this: [sourcecode language=”javascript”] String.prototype.toCharCodes = function() Read more…

By Chris West, ago
Blog

getMatches(str, exp)

I recently encountered two troubling bugs with jPaq’s String.prototype.indexOfPattern() function.  In order to fix it, I ended up exploring the powerful String.prototype.replace() function, exploiting the parameter passed into the callback function.  I already knew that the matched text and sub-groups were passed into the callback function.  The thing that I Read more…

By Chris West, ago
Blog

No jPaq.openWindow() For Now

Up until today, I was interested in writing a more object oriented version of the native window.open() function.  Unfortunately, I found out that there are some major incompatibility issues between browsers.  Let’s take this example for instance: [sourcecode language=”js”] window.open(“http://google.com/”, “”, “left=100,screenX=100,top=100,screenY=100,height=400”); window.open(“http://google.com/”, “”, “left=100,screenX=100,top=100,screenY=100,width=400”); [/sourcecode] As you may have Read more…

By Chris West, ago