@@ -321,7 +321,7 @@ helpers.join = function(array, separator) {
321321 * @return {String }
322322 * @block
323323 * @api public
324- * @example {{equalsLength [1, 2, 3] 3}} -> true
324+ * @example {{equalsLength ' [1,2,3]' 3}} -> true
325325 */
326326
327327helpers . equalsLength = function ( value , length , options ) {
@@ -330,10 +330,7 @@ helpers.equalsLength = function(value, length, options) {
330330 length = 0 ;
331331 }
332332
333- var len = 0 ;
334- if ( typeof value === 'string' || Array . isArray ( value ) ) {
335- len = value . length ;
336- }
333+ var len = helpers . length ( value ) ;
337334
338335 return util . value ( len === length , this , options ) ;
339336} ;
@@ -389,13 +386,17 @@ helpers.last = function(value, n) {
389386 * @param {Array|Object|String } `value`
390387 * @return {Number } The length of the value.
391388 * @api public
392- * @example {{length [1, 2, 3]}} -> 3
389+ * @example {{length ' [1, 2, 3]' }} -> 3
393390 */
394391
395392helpers . length = function ( value ) {
396393 if ( util . isObject ( value ) && ! util . isOptions ( value ) ) {
397394 value = Object . keys ( value ) ;
398395 }
396+ // this is an inline array, split it
397+ if ( typeof value === 'string' && value . startsWith ( "[" ) && value . endsWith ( "]" ) ) {
398+ return value . split ( "," ) . length ;
399+ }
399400 if ( typeof value === 'string' || Array . isArray ( value ) ) {
400401 return value . length ;
401402 }
0 commit comments