Last active
October 25, 2021 11:39
-
-
Save Akjosch/fb6a6897f974649730c9bcf33e6f3ddb to your computer and use it in GitHub Desktop.
Array extension methods for SugarCube, quick & dirty version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict";Object.defineProperty(Array.prototype,"countWith",{configurable:!0,writable:!0,value:function value(predicate,thisArg){if(null==this)throw new TypeError("Array.prototype.countWith called on null or undefined");if("function"!=typeof predicate)throw new Error("Array.prototype.countWith predicate parameter must be a function");var length=this.length>>>0;if(0==length)return[];for(var count=0,i=0;i<length;++i)count+=!!predicate.call(thisArg,this[i],i,this);return count}}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment