Permalink
Browse files

more efficient string checking

  • Loading branch information...
1 parent e72383c commit bd6aadae5abc1daa76acc8bea69562395ebfb3b6 @fent fent committed Feb 7, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/eventvat.js
View
@@ -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);
@@ -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;
@@ -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);

0 comments on commit bd6aada

Please sign in to comment.