MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / test_find_self_jsfunction

Function test_find_self_jsfunction

tests/python/test_arrays.py:1974–1988  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1972
1973
1974def test_find_self_jsfunction():
1975 items = ['Four', 'Three', 'One']
1976
1977 result = pm.eval("""
1978 (arr) => {
1979 function increment(element, index, array) {
1980 this.count++;
1981 return false;
1982 }
1983 let jsObj = {count: 0}
1984 arr.find(increment, jsObj);
1985 return jsObj.count;
1986 }
1987 """)(items)
1988 assert result == 3
1989
1990# findIndex
1991

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected