Skip to content

Commit

Permalink
update brain syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
gasolin committed Feb 2, 2017
1 parent 856b48b commit 9e21511
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -3,11 +3,12 @@
[![Build Status](https://travis-ci.org/gasolin/webby.png)](https://travis-ci.org/gasolin/webbybot) [![codecov.io](https://codecov.io/github/gasolin/webbybot/coverage.svg?branch=master)](https://codecov.io/github/gasolin/webbybot?branch=master) [![Dependency Status](https://david-dm.org/gasolin/webbybot.svg)](https://david-dm.org/gasolin/webbybot) [![npm](https://img.shields.io/npm/v/webbybot.svg)](https://www.npmjs.com/package/webbybot)
[![Join the chat at https://gitter.im/gasolin/webbybot](https://badges.gitter.im/gasolin/webbybot.svg)](https://gitter.im/gasolin/webbybot?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[Webbybot](https://github.com/gasolin/webbybot/) is the next generation message/chat bot framework written in ES6 and plain javascript. Fully compatible with [Hubot](https://github.com/github/hubot)'s middleware and plugins.
[Webbybot](https://github.com/gasolin/webbybot/) is the next generation framework to build message/chat bots, written in ES6 and plain javascript.
Fully compatible with [Hubot](https://github.com/github/hubot)'s middleware and plugins.

The Differences:

* Port hubot from coffeescript to es6 (plain JS) with babel.
* Port hubot from CoffeeScript to ES6 (plain JS) with babel.
* Auto test coverage report with Codecov.
* Auto linting with eslint.
* Support .env file to setup system parameters
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "webbybot",
"version": "3.2.5",
"version": "3.2.6",
"description": "A simple helpful robot written in es6, compatible with hubot",
"main": "dist/index.js",
"bin": {
Expand Down
8 changes: 3 additions & 5 deletions src/brain.js
Expand Up @@ -27,11 +27,10 @@ class Brain extends EventEmitter {
* Returns the instance for chaining.
*/
set(key, value) {
let pair;
let pair = {};
if (key === Object(key)) {
pair = key;
} else {
pair = {};
pair[key] = value;
}
// extend this.data._private
Expand All @@ -47,8 +46,7 @@ class Brain extends EventEmitter {
* Returns the value.
*/
get(key) {
let ref;
return (ref = this.data._private[key]) != null ? ref : null;
return this.data._private[key] || null;
}

/**
Expand All @@ -58,7 +56,7 @@ class Brain extends EventEmitter {
* Returns the instance for chaining.
*/
remove(key) {
if (this.data._private[key] != null) {
if (this.data._private.hasOwnProperty(key)) {
delete this.data._private[key];
}
return this;
Expand Down

0 comments on commit 9e21511

Please sign in to comment.