Permalink
Browse files

protect against occasional non-strings reading YAML parse

  • Loading branch information...
1 parent 6dac8e5 commit e8727cdb39b09499aadd966226d5ee9edde696f9 @aahoughton aahoughton committed Sep 25, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/beanstalk_client.js
View
6 lib/beanstalk_client.js
@@ -7,6 +7,10 @@ var events = require('events'),
// because yaml doesn't like beanstalk
var yaml = new function() {
this.eval = function(str) {
+ if (!str.replace) {
+ return str;
+ }
+
// YAML sucks, reg exp to make it working(ish)
var corrected = str.replace(/\n-\ ([\w\d_-]+)/mig, '\n - \'$1\'') //indent list
.replace(/(\w)\-(\w)/mgi, '$1_$2') // replace minuses in hash names
@@ -435,4 +439,4 @@ var Beanstalk = function(server) {
};
exports.Client = Beanstalk;
-exports.Debug = Debug;
+exports.Debug = Debug;

0 comments on commit e8727cd

Please sign in to comment.