Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/bh.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ function BH() {
isSimple: function(obj) {
if (!obj || obj === true) return true;
var t = typeof obj;
return t === 'string' || t === 'number';
return t === 'string' || t === 'number' ||
Boolean(typeof obj.tag !== 'undefined' && !obj.tag && obj.html);
},
/**
* Расширяет один объект свойствами другого (других).
Expand Down
3 changes: 3 additions & 0 deletions test/test.isSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ describe('ctx.isSimple()', function() {
it('should return true for string', function() {
bh.utils.isSimple('1').should.equal(true);
});
it('should return true for escaped string', function() {
bh.utils.isSimple({ tag: false, html: '42' }).should.equal(true);
});
it('should return true for boolean', function() {
bh.utils.isSimple(false).should.equal(true);
});
Expand Down