Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Commit

Permalink
add hasChanged(attr) method to record
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Waldmann committed Apr 4, 2014
1 parent c9e1ed1 commit cbcd6a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions lib/base/attributes.js
Expand Up @@ -202,6 +202,19 @@ exports.record = {
return Object.keys(this.changes).length > 0;
},

/**
* Returns `true` if the given attributes has changed
*
* @section Record
* @method hasChanged
* @param {string} name - The attributes name
*
* @return {boolean}
*/
hasChanged: function(name){
return Object.keys(this.changes).indexOf(name) !== -1;
},

/**
* Returns an object with all the changes. One attribute will always include the original and current value
*
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "openrecord",
"version": "0.11.3",
"version": "0.11.4",
"description": "Active record like ORM for nodejs",
"keywords": ["orm", "record", "sql", "sqlite3", "postgres", "pg", "mysql", "database", "activerecord"],
"author": "Philipp Waldmann <philipp.waldmann@s-team.at>",
Expand Down

0 comments on commit cbcd6a4

Please sign in to comment.