Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Created January 29, 2017 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidgilbertson/2492ddfbcbebe844f9914fe9de843160 to your computer and use it in GitHub Desktop.
Save davidgilbertson/2492ddfbcbebe844f9914fe9de843160 to your computer and use it in GitHub Desktop.
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var BetterArray = function () {
function BetterArray(arr) {
_classCallCheck(this, BetterArray);
this.arr = arr;
}
_createClass(BetterArray, [{
key: "has",
value: function has(item) {
return this.arr.includes(item);
}
}]);
return BetterArray;
}();
var myArray = new BetterArray([1, 2, 3]);
console.log(myArray.has(2)); // true
console.log(myArray.has(4)); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment