Socket
Socket
Sign inDemoInstall

like-ar

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

like-ar - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

32

like-ar.js

@@ -49,2 +49,22 @@ "use strict";

ObjectWithArrayMethodsOptimized.prototype.keys = function keys(){
return Object.keys(this._object);
};
ObjectWithArrayMethodsOptimized.prototype.values = function values(){
if(typeof Object.values === 'function'){
return Object.values(arr);
}
var arr = [];
var oThis=this._object;
for(var attr in oThis){ if(oThis.hasOwnProperty(attr)){
arr.push(oThis[attr]);
}}
return arr;
};
ObjectWithArrayMethodsOptimized.prototype.join = function join(separator){
return this.values().join(separator);
};
function ArrayAndKeys2Object(result, keys){

@@ -64,4 +84,9 @@ var adapted = {};

{name:'filter' , resultAdapt: Argument3Adapt, stepAdapt:function(x, v, n, a){ if(x){a[n]=v;} }},
{name:'join' , useOptimized: true },
{name:'values' , useOptimized: true },
{name:'keys' , useOptimized: true },
].forEach(function(method){
ObjectWithArrayMethodsNonOptimized.prototype[method.name] = function (f, fThis){
ObjectWithArrayMethodsNonOptimized.prototype[method.name] = method.useOptimized ?
ObjectWithArrayMethodsOptimized.prototype[method.name] :
function (f, fThis){
var oThis=this._object;

@@ -72,3 +97,6 @@ var keys=Object.keys(oThis);

var arrayValue=oThis[arrayKey];
return (method.stepAdapt||id)(f.call(fThis, arrayValue, arrayKey, oThis), arrayValue, arrayKey, acumulator);
return (method.stepAdapt||id)(
typeof f === "function" ? f.call(fThis, arrayValue, arrayKey, oThis) : f,
arrayValue, arrayKey, acumulator
);
}, fThis);

@@ -75,0 +103,0 @@ return (method.resultAdapt||id)(result, keys, acumulator);

6

package.json
{
"name": "like-ar",
"description": "Using objects like arrays with map, filter, forEach and others coming soon.",
"version": "0.0.1",
"version": "0.1.0",
"author": "Codenautas <codenautas@googlegroups.com>",

@@ -17,5 +17,5 @@ "repository": "codenautas/like-ar",

"istanbul": "~0.4.5",
"mocha": "~3.2.0",
"mocha": "~3.3.0",
"json4all": "~0.3.0"
"json4all": "~0.3.3"
},

@@ -22,0 +22,0 @@ "engines": {

@@ -5,3 +5,3 @@ # like-ar

![designing](https://img.shields.io/badge/stability-designing-red.svg)
![extending](https://img.shields.io/badge/stability-extending-orange.svg)
[![npm-version](https://img.shields.io/npm/v/like-ar.svg)](https://npmjs.org/package/like-ar)

@@ -8,0 +8,0 @@ [![downloads](https://img.shields.io/npm/dm/like-ar.svg)](https://npmjs.org/package/like-ar)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc