diff --git a/es5/infinity.js b/es5/infinity.js index 625b0d4..4251e78 100644 --- a/es5/infinity.js +++ b/es5/infinity.js @@ -66,10 +66,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return key in obj || areNumbers(index) && index % 1 === 0 && index >= 0; }, enumerate: function enumerate(obj) { - return obj.keys(); + return Object.keys(obj); }, ownKeys: function ownKeys(obj) { - return obj.keys(); + return Object.keys(obj); } }; diff --git a/es5/infinity.min.js b/es5/infinity.min.js index 3ebb8f5..386408c 100644 --- a/es5/infinity.min.js +++ b/es5/infinity.min.js @@ -1 +1 @@ -"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}(function(f){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.isEq=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i=0},enumerate:function enumerate(obj){return obj.keys()},ownKeys:function ownKeys(obj){return obj.keys()}};var InfiniteList=function InfiniteList(start,next){_classCallCheck(this,InfiniteList);this.__start__=start;this.__next__=next;this.__cache__=[];if(typeof Proxy!=="undefined")return new Proxy(this,handler)};if(typeof Symbol!=="undefined"&&Symbol.iterator){InfiniteList.prototype[Symbol.iterator]=function(){var _this=this;var j=0;return{next:function next(){return{value:_this.get(j++),done:false}}}}}InfiniteList.prototype.get=function(index){if(isNonZeroFalsy(index)||index<0||!areNumbers(index))return;var start=this.__start__;var next=this.__next__;var cache=this.__cache__;if(!cache[0])cache[0]=start;if(index===Infinity)return new InfiniteListItem(this,Infinity,Infinity);if(index in cache)return new InfiniteListItem(this,cache[index],index);if(!(index in cache)){if(cache.length<=index&&cache.length-1 in cache)while(cache.length<=index){cache[cache.length]=next(cache[cache.length-1],cache[cache.length-2])}}return new InfiniteListItem(this,cache[index],index)};InfiniteList.prototype.clearCache=function(){this.__cache__=[]};InfiniteList.prototype.take=function(from,to){var arr=[];if(isNonZeroFalsy(from)||from===0&&isNonZeroFalsy(to)||!areNumbers(from)&&isNonZeroFalsy(to))return arr;var source=void 0,target=void 0;if(isNonZeroFalsy(to)){source=0;target=from}else{source=from;target=to+1}for(var i=source;i=0},enumerate:function enumerate(obj){return Object.keys(obj)},ownKeys:function ownKeys(obj){return Object.keys(obj)}};var InfiniteList=function InfiniteList(start,next){_classCallCheck(this,InfiniteList);this.__start__=start;this.__next__=next;this.__cache__=[];if(typeof Proxy!=="undefined")return new Proxy(this,handler)};if(typeof Symbol!=="undefined"&&Symbol.iterator){InfiniteList.prototype[Symbol.iterator]=function(){var _this=this;var j=0;return{next:function next(){return{value:_this.get(j++),done:false}}}}}InfiniteList.prototype.get=function(index){if(isNonZeroFalsy(index)||index<0||!areNumbers(index))return;var start=this.__start__;var next=this.__next__;var cache=this.__cache__;if(!cache[0])cache[0]=start;if(index===Infinity)return new InfiniteListItem(this,Infinity,Infinity);if(index in cache)return new InfiniteListItem(this,cache[index],index);if(!(index in cache)){if(cache.length<=index&&cache.length-1 in cache)while(cache.length<=index){cache[cache.length]=next(cache[cache.length-1],cache[cache.length-2])}}return new InfiniteListItem(this,cache[index],index)};InfiniteList.prototype.clearCache=function(){this.__cache__=[]};InfiniteList.prototype.take=function(from,to){var arr=[];if(isNonZeroFalsy(from)||from===0&&isNonZeroFalsy(to)||!areNumbers(from)&&isNonZeroFalsy(to))return arr;var source=void 0,target=void 0;if(isNonZeroFalsy(to)){source=0;target=from}else{source=from;target=to+1}for(var i=source;i= 0)) ) }, - enumerate: obj => obj.keys(), - ownKeys: obj => obj.keys(), + enumerate: obj => Object.keys(obj), + ownKeys: obj => Object.keys(obj), }; class InfiniteList {