Skip to content

Commit

Permalink
Really fix #95
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Apr 2, 2015
1 parent 5a59717 commit 6d8d2ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/messageformat.dev.js
Expand Up @@ -206,7 +206,7 @@
* @returns {string} The result of the pluralization
*/
plural: function(value, offset, lcfunc, data, isOrdinal) {
if (data.hasOwnProperty(value)) return data[value]();
if ({}.hasOwnProperty.call(data, value)) return data[value]();
if (offset) value -= offset;
var key = lcfunc(value, isOrdinal);
if (key in data) return data[key]();
Expand All @@ -221,7 +221,7 @@
* @returns {string} The result of the select statement
*/
select: function(value, data) {
if (data.hasOwnProperty(value)) return data[value]();
if ({}.hasOwnProperty.call(data, value)) return data[value]();
return data.other()
},

Expand Down
4 changes: 2 additions & 2 deletions messageformat.js
Expand Up @@ -206,7 +206,7 @@
* @returns {string} The result of the pluralization
*/
plural: function(value, offset, lcfunc, data, isOrdinal) {
if (data.hasOwnProperty(value)) return data[value]();
if ({}.hasOwnProperty.call(data, value)) return data[value]();
if (offset) value -= offset;
var key = lcfunc(value, isOrdinal);
if (key in data) return data[key]();
Expand All @@ -221,7 +221,7 @@
* @returns {string} The result of the select statement
*/
select: function(value, data) {
if (data.hasOwnProperty(value)) return data[value]();
if ({}.hasOwnProperty.call(data, value)) return data[value]();
return data.other()
},

Expand Down
2 changes: 1 addition & 1 deletion test/tests.js
Expand Up @@ -663,7 +663,7 @@ describe( "MessageFormat", function () {

it("should not expose prototype members - selects", function () {
var mf = new MessageFormat( 'en' );
var mfunc = mf.compile("I am {FEELING, select, a{happy} b{sad} other{indifferent}}.");
var mfunc = mf.compile("I am {FEELING, select, a{happy} hasOwnProperty{evil} other{indifferent}}.");
expect(mfunc({FEELING:"toString"})).to.eql("I am indifferent.");
});

Expand Down

0 comments on commit 6d8d2ef

Please sign in to comment.