New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

alodash

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alodash - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

12

index.js

@@ -10,7 +10,9 @@ const _ = require('lodash');

return function (obj, ...args) {
return Promise.resolve(obj)
.then(function (result) {
const params = args.unshift(result);
return _[name.substring(1)].apply(null, args);
return function (...args) {
const pargs = args.map(function(arg) {
return Promise.resolve(arg);
});
return Promise.all(pargs)
.then(function(resolvedArgs) {
return _[name.substring(1)].apply(null, resolvedArgs);
});

@@ -17,0 +19,0 @@ }

{
"name": "alodash",
"version": "0.1.0",
"version": "0.2.0",
"description": "Simple promise proxy for lodash",

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

@@ -24,1 +24,3 @@ # alodash

```
Any of the function parameters can be a value, a promise, or function.

@@ -8,8 +8,8 @@

const prodash = require('../');
const alodash = require('../');
describe('prodash', function(){
describe('alodash', function(){
it('should destructure a function', function(done){
const { aget } = prodash;
const { aget } = alodash;
aget.should.be.a('function');

@@ -19,4 +19,15 @@ done();

it('should reject if not a lodash function', function(done){
const { aNotALodashFunction } = alodash;
aNotALodashFunction()
.then(function(){
done(new Error('should not get here'));
})
.catch(function(err) {
done();
});
});
it('should return lodash from a _', function(done){
const { _ } = prodash;
const { _ } = alodash;
_.should.be.a('function');

@@ -26,5 +37,6 @@ done();

it('should call a lodash function with a promise', function(done){
const promise = Promise.resolve({some:{ nested: {prop: 1}}});
const { aget } = prodash;
const { aget } = alodash;
aget(promise, 'some.nested.prop')

@@ -38,5 +50,46 @@ .then(function(val) {

});
});
it('should call a lodash function without requiring a promise', function(done){
const { amean } = alodash;
amean([4, 2, 8, 6])
.then(function(val) {
val.should.equal(5);
done();
})
.catch(function(error) {
done(error);
});
});
it('should call a lodash function with mutliple promise params', function(done){
const { aclamp } = alodash;
aclamp(Promise.resolve(-10), Promise.resolve(-5), Promise.resolve(5))
.then(function(val) {
val.should.equal(-5);
done();
})
.catch(function(error) {
done(error);
});
});
it('should call a lodash function that has a function param', function(done){
const { afind } = alodash;
const users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false },
{ 'user': 'pebbles', 'age': 1, 'active': true }
];
afind(Promise.resolve(users), function(o) { return o.age < 40; })
.then(function(val) {
val.user.should.equal('barney');
done();
})
.catch(function(error) {
done(error);
});
});
});

Sorry, the diff of this file is not supported yet

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