Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #440 from drhayes/master
Browse files Browse the repository at this point in the history
Don't use JSON.parse/stringify to clone.
  • Loading branch information
Ben Brown authored Nov 7, 2016
2 parents 8e8ffcc + d3bbf02 commit 47ea1ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/CoreBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var simple_storage = require(__dirname + '/storage/simple_storage.js');
var ConsoleLogger = require(__dirname + '/console_logger.js');
var LogLevels = ConsoleLogger.LogLevels;
var ware = require('ware');
var clone = require('clone');

var studio = require('./Studio.js');

Expand Down Expand Up @@ -457,7 +458,7 @@ function Botkit(configuration) {

this.cloneMessage = function(message) {
// clone this object so as not to modify source
var outbound = JSON.parse(JSON.stringify(message));
var outbound = clone(message);

if (typeof(message.text) == 'string') {
outbound.text = this.replaceTokens(message.text);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"back": "^1.0.1",
"body-parser": "^1.14.2",
"botbuilder": "^3.2.3",
"clone": "2.0.0",
"command-line-args": "^3.0.0",
"express": "^4.13.3",
"https-proxy-agent": "^1.0.0",
Expand Down

0 comments on commit 47ea1ef

Please sign in to comment.