+1
-1
| service_name: travis-pro | ||
| repo_token: JI42fb9ye0tMnVXga4NFiXMWkULTgXrYq | ||
| repo_token: Dr2yek33B42HaM0n0JIugiASt1HaB7n3N |
+7
-5
@@ -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 @@ } |
+1
-1
| { | ||
| "name": "alodash", | ||
| "version": "0.1.0", | ||
| "version": "0.2.0", | ||
| "description": "Simple promise proxy for lodash", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+2
-0
@@ -24,1 +24,3 @@ # alodash | ||
| ``` | ||
| Any of the function parameters can be a value, a promise, or function. |
+58
-5
@@ -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); | ||
| }); | ||
| }); | ||
| }); |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
4543
52.76%95
111.11%26
8.33%1
Infinity%