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

@gitrows/gitrows-utils

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gitrows/gitrows-utils - npm Package Compare versions

Comparing version 0.1.1 to 0.1.3

35

lib/data.js

@@ -19,8 +19,8 @@ const Data={

}
obj=Object.arr(obj);
obj=Object.values(obj);
Object.keys(filter).forEach((key) => {
if (key.indexOf('$')==0) return;
let arr=filter[key];
if (!Array.isArray(arr)) arr=[arr];
arr.forEach((item, i) => {
let values=filter[key];
if (!Array.isArray(values)) values=[values];
values.forEach((item, i) => {
let value=item.toString();

@@ -72,9 +72,9 @@ if (value.indexOf(':')>-1){

pluck:(obj,keys)=>{
let returnAsarr=false;
let returnAsValues=false;
if(!Array.isArray(keys)){
if (keys=='*') return obj;
keys=[keys];
returnAsarr=true;
returnAsValues=true;
}
obj=Object.arr(obj);
obj=Object.values(obj);
let result=[];

@@ -85,3 +85,3 @@ obj.forEach((item, i) => {

if (~keys.indexOf(key)) {
if (returnAsarr)
if (returnAsValues)
result[i]=item[key];

@@ -152,6 +152,6 @@ else

items.forEach((item, i) => {
let arr=item.split(':');
if (!arr.length==2) return;
if (arr[1]=='asc') data=Data.asc(data,arr[0]);
if (arr[1]=='desc') data=Data.desc(data,arr[0]);
let values=item.split(':');
if (!values.length==2) return;
if (values[1]=='asc') data=Data.asc(data,values[0]);
if (values[1]=='desc') data=Data.desc(data,values[0]);
});

@@ -165,4 +165,4 @@ else return;

if (aggregates['$limit']){
arr=aggregates['$limit'].toString().split(',');
data=Data.limit(data,+arr[0],+arr[1]);
values=aggregates['$limit'].toString().split(',');
data=Data.limit(data,+values[0],+values[1]);

@@ -245,8 +245,8 @@ }

arrApply:(obj,arr,query)=>{
valuesApply:(obj,values,query)=>{
if (!Array.isArray(obj)){
obj=Object.assign(obj, arr)
obj=Object.assign(obj, values)
}
else
obj.forEach((row,index) => obj[index]=Data.where([row],query).length?Data.arrApply(row,arr):row);
obj.forEach((row,index) => obj[index]=Data.where([row],query).length?Data.valuesApply(row,values):row);
return obj;

@@ -301,3 +301,4 @@ },

}
module.exports=Data;
{
"name": "@gitrows/gitrows-utils",
"version": "0.1.1",
"version": "0.1.3",
"description": "Data and string handling utilities for @gitrows",

@@ -5,0 +5,0 @@ "main": "index.js",

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