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

Function test_some_self_jsfunction

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

Source from the content-addressed store, hash-verified

1706
1707
1708def test_some_self_jsfunction():
1709 items = ['Four', 'Three', 'One']
1710
1711 result = pm.eval("""
1712 (arr) => {
1713 function increment(element, index, array) {
1714 this.count++;
1715 return false;
1716 }
1717 let jsObj = {count: 0}
1718 arr.some(increment, jsObj);
1719 return jsObj.count;
1720 }
1721 """)(items)
1722 assert result == 3
1723
1724# every
1725

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected