diff --git a/lib/bh.js b/lib/bh.js index f8acdce..6bf1b2a 100644 --- a/lib/bh.js +++ b/lib/bh.js @@ -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); }, /** * Расширяет один объект свойствами другого (других). diff --git a/test/test.isSimple.js b/test/test.isSimple.js index ede17e6..ff17ee5 100644 --- a/test/test.isSimple.js +++ b/test/test.isSimple.js @@ -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); });