Comparing version 0.1.7 to 0.1.8
{ | ||
"name": "nyks", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "nodejs exupery style", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -50,2 +50,9 @@ nyks provide a set of "missing" stuffs in nodejs basic api. | ||
* String.prototype.replaces(dict) | ||
Replace key => value in current string | ||
* String.prototype.rreplaces(dict) | ||
Recursive (iterative) replaces | ||
* String.prototype.stripEnd(str) | ||
@@ -52,0 +59,0 @@ Return trimmed string of "str" if present (else, leave untouched) |
@@ -26,2 +26,20 @@ Buffer.implement({ | ||
String.implement({ | ||
replaces : function(hash){ | ||
var self = this; | ||
Object.each(hash, function(v, k){ | ||
self = self.replace(k, v); | ||
}); | ||
return self; | ||
}, | ||
//recursive version of replaces | ||
rreplaces : function(hash){ | ||
var tmp = "", i = this; | ||
do { | ||
tmp = i; | ||
i = i.replaces(hash); | ||
} while(tmp != i); | ||
return tmp; | ||
}, | ||
startsWith: function(str){ | ||
@@ -28,0 +46,0 @@ return (this.indexOf(str) === 0); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6738
150
64