MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / getPooledTraverseContext

Function getPooledTraverseContext

bundle.js:1978–1996  ·  view source on GitHub ↗
(mapResult, keyPrefix, mapFunction, mapContext)

Source from the content-addressed store, hash-verified

1976 var POOL_SIZE = 10;
1977 var traverseContextPool = [];
1978 function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
1979 if (traverseContextPool.length) {
1980 var traverseContext = traverseContextPool.pop();
1981 traverseContext.result = mapResult;
1982 traverseContext.keyPrefix = keyPrefix;
1983 traverseContext.func = mapFunction;
1984 traverseContext.context = mapContext;
1985 traverseContext.count = 0;
1986 return traverseContext;
1987 } else {
1988 return {
1989 result: mapResult,
1990 keyPrefix: keyPrefix,
1991 func: mapFunction,
1992 context: mapContext,
1993 count: 0
1994 };
1995 }
1996 }
1997
1998 function releaseTraverseContext(traverseContext) {
1999 traverseContext.result = null;

Callers 2

forEachChildrenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected