Skip to content

Commit

Permalink
more efficient string checking
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Feb 7, 2012
1 parent e72383c commit bd6aada
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/eventvat.js
Expand Up @@ -352,7 +352,7 @@
// Get a substring of the string stored at a key
//
EventVat.prototype.getrange = function(key, start, end) {
if (has(this.hash, key) && this.type(key) === 'string') {
if (this.type(key) === 'string') {
var value = this.hash[key].value.slice(start, end);
this.emit('getrange ' + key, value);
this.emit('getrange', key, value);
Expand Down Expand Up @@ -539,7 +539,7 @@
// Set the value of a string within the given range
//
EventVat.prototype.setrange = function(key, offset, value) {
if (has(this.hash, key) && this.type(key) === 'string') {
if (this.type(key) === 'string') {
var p1 = this.hash[key].value.slice(0, offset);
var p2 = this.hash[key].value.slice(offset + value.length);
var newValue = p1 + value + p2;
Expand All @@ -560,7 +560,7 @@
// Get the length of the value stored in a key
//
EventVat.prototype.strlen = function(key) {
if(has(this.hash, key) && this.type(key) === 'string') {
if(this.type(key) === 'string') {
var l = this.hash[key].value.length;
this.emit('strlen ' + key, l);
this.emit('strlen', key, l);
Expand Down

0 comments on commit bd6aada

Please sign in to comment.