1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * @fileoverview General utility functions for rule stores.
9 goog
.provide('cvox.StoreUtil');
13 * Count list of nodes and concatenate this with the context string.
14 * Returns a closure with a local state.
15 * @param {Array<Node>} nodes A node array.
16 * @param {?string} context A context string.
17 * @return {function(): string} A function returning a string.
19 cvox
.StoreUtil
.nodeCounter = function(nodes
, context
) {
21 var localLength
= nodes
.length
;
23 var localContext
= context
;
28 if (localCounter
< localLength
) {
31 return localContext
+ ' ' + localCounter
;