Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.2.12 to 0.2.13

9

like-ar.d.ts
declare module "like-ar"{
type ObjectWithArrayFunctions<T, K extends string|number|symbol>={
type ObjectWithArrayFunctions<T, K extends keyof any>={
forEach: ( callback:(value:T, key:K)=>void ) => ObjectWithArrayFunctions<T,K>

@@ -12,9 +12,10 @@ map :<U>( callback:(value:T, key:K)=>U ) => ObjectWithArrayFunctions<U,K>

}
function likeAr<T, K extends string|number|symbol>(o:{[key in K]: T}):ObjectWithArrayFunctions<T, K>
function likeAr<T, K extends keyof any>(o:{[key in K]: T}):ObjectWithArrayFunctions<T, K>
namespace likeAr{
function toPlainObject<T>(array:[string, T][]):{[key:string]:T}
function toPlainObject<T, K extends keyof T>(array:T, keyName:K, valueName:K):{[key:string]:T}
function toPlainObject<T>(arrayKeys:[string], arrayValues:[T]):{[key:string]:T}
function toPlainObject<T, K extends keyof T>(array:T, keyName:K, valueName:K):{[key:string]:T[K]}
function toPlainObject<T, K extends keyof any>(arrayKeys:K[], arrayValues:T[]):{[key in K]:T}
function createIndex<T, K extends keyof T>(array:T, keyName:K):{[key:string]:T}
}
export = likeAr
}

@@ -164,3 +164,2 @@ "use strict";

});
}else{

@@ -182,4 +181,14 @@ var keyName=keyNameOrArrayOfValues;

likeAr.createIndex = function createIndex(array, keyname,){
var o={};
var keyName=keyname;
var pairs=array;
pairs.forEach(function(pair, i){
o[pair[keyName]]=pair;
});
return o;
};
return likeAr;
});
{
"name": "like-ar",
"description": "Using objects like arrays with map, filter, forEach and others coming soon.",
"version": "0.2.12",
"version": "0.2.13",
"author": "Codenautas <codenautas@googlegroups.com>",

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

"json4all": "~0.3.10",
"mocha": "~6.0.2",
"mocha": "~6.1.4",
"istanbul": "~0.4.5",
"nyc": "~13.3.0"
"nyc": "~14.1.1",
"discrepances": "0.2.4"
},

@@ -23,0 +24,0 @@ "engines": {

@@ -88,3 +88,2 @@ # like-ar

## likeAr.toPlainObject(array [,keyName [,valueName]])

@@ -111,2 +110,20 @@ ## likeAr.toPlainObject(arrayOfKeys, arrayOfValues)

## likeAr.createIndex(array:T[],keyName:string):{[k:string]: T}
Returns a plain object containing the same element indexed by keyName
# Usage
```sh
var likeAr = require('like-ar');
var persons=[{name:'Diego', lastName:'Rivera', age:30}, {name:'Frida', lastName:'Kahlo'}];
var idxPersons=likeAr.createIndex(persons, 'lastName');
idxPersons.Kahlo.age=20;
console.log(persons[1].age); // 20
```
## License

@@ -113,0 +130,0 @@

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