Comparing version 1.2.5 to 1.2.7
{ | ||
"name": "protos.js", | ||
"version": "1.2.5", | ||
"version": "1.2.7", | ||
"description": "String and Array prototypes for a more easy life", | ||
@@ -5,0 +5,0 @@ "main": "protos.js", |
@@ -59,2 +59,6 @@ /* | ||
Array.prototype.log = function() { | ||
this.forEach(function(item) { console.log(item); }); | ||
} | ||
String.prototype.err = function() { | ||
@@ -183,2 +187,7 @@ console.error(this.toString()); | ||
Array.prototype.smap = function(fn) { | ||
for (var i=0; i<this.length; i++) { | ||
this[i] = fn(this[i]); | ||
} | ||
} | ||
@@ -281,2 +290,3 @@ String.prototype.load = function(filename, cb) { | ||
// ASCII | ||
@@ -289,9 +299,13 @@ | ||
String.prototype.chr = function() { | ||
var asc = []; | ||
var s = this.toString(); | ||
for (var i=0; i<s.length; i++) { | ||
asc.push(s.charCodeAt(i)); | ||
if (this.length == 1) { | ||
return this.charCodeAt(0); | ||
} else { | ||
var asc = []; | ||
var s = this.toString(); | ||
for (var i=0; i<s.length; i++) { | ||
asc.push(s.charCodeAt(i)); | ||
} | ||
s = ''; | ||
return asc; | ||
} | ||
s = ''; | ||
return asc; | ||
} | ||
@@ -298,0 +312,0 @@ |
Sorry, the diff of this file is not supported yet
13344
386
237