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

lodash-decorators

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash-decorators - npm Package Compare versions

Comparing version 0.2.6 to 0.3.0

extensions/configurable.js

19

index.js

@@ -9,6 +9,2 @@ 'use strict';

var _lodashStringCapitalize = require('lodash/string/capitalize');
var _lodashStringCapitalize2 = _interopRequireDefault(_lodashStringCapitalize);
var _lodashObjectForOwn = require('lodash/object/forOwn');

@@ -38,2 +34,6 @@

var _utilsNormalizeExport = require('./utils/normalizeExport');
var _utilsNormalizeExport2 = _interopRequireDefault(_utilsNormalizeExport);
var methods = {

@@ -47,3 +47,3 @@ instance: {

single: ['spread', 'rearg', 'negate'],
pre: ['ary', 'curry', 'curryRight', 'restParam'],
pre: ['modArgs', 'ary', 'curry', 'curryRight', 'restParam'],
partial: ['partial', 'partialRight'],

@@ -74,10 +74,3 @@ wrap: ['wrap'],

// Provide aliases @memoize => @Memoize
// This is for users who prefer capitalized decorators and
// can prevent naming collissions.
(0, _lodashObjectForOwn2['default'])(result, function (value, key) {
return result[(0, _lodashStringCapitalize2['default'])(key)] = value;
});
exports['default'] = result;
exports['default'] = (0, _utilsNormalizeExport2['default'])(result);
module.exports = exports['default'];

@@ -5,3 +5,3 @@ {

"description": "A collection of decorators using lodash at it's core.",
"version": "0.2.6",
"version": "0.3.0",
"engines": {

@@ -44,4 +44,4 @@ "node": ">=0.12.0"

"dependencies": {
"lodash": "~3.9.0"
"lodash": "~3.10.0"
}
}

@@ -27,2 +27,4 @@ # lodash-decorators

- [Example](#example-6)
- [Extensions](#extensions)
- [Validate](#validate)

@@ -62,2 +64,3 @@ <!-- END doctoc generated TOC please keep comment here to allow auto update -->

- `bind`
- `modArgs`

@@ -307,3 +310,16 @@ #### Example

### Extensions
Extensions are decorators that aren't necessarily Lodash functions, but use Lodash under the hood. They
provided some more basic utilities not found in Lodash;
These can be found in `src/extensions`
### Validate
The validate module contains decorators that can validate function arguments and return value.
These can be found in `src/validate`
Author: Steven Sojka
MIT Licensed

@@ -7,2 +7,4 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _decoratorFactory = require('./decoratorFactory');

@@ -12,12 +14,9 @@

var _utilsReturnAtIndex = require('./utils/returnAtIndex');
var _utilsReturnAtIndex2 = _interopRequireDefault(_utilsReturnAtIndex);
exports['default'] = (0, _decoratorFactory.createDecorator)(function tapDecorator(fn) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
fn.call.apply(fn, [this].concat(args));
return args[0];
};
return (0, _utilsReturnAtIndex2['default'])(fn, 0);
}, _Applicator.applicators.single);
module.exports = exports['default'];

@@ -9,42 +9,18 @@ 'use strict';

var _lodashCollectionEvery = require('lodash/collection/every');
var _utilsNormalizeExport = require('../utils/normalizeExport');
var _lodashCollectionEvery2 = _interopRequireDefault(_lodashCollectionEvery);
var _utilsNormalizeExport2 = _interopRequireDefault(_utilsNormalizeExport);
var _decoratorFactory = require('../decoratorFactory');
var _validate = require('./validate');
exports['default'] = (0, _decoratorFactory.createDecorator)(validateDecorator);
var _validate2 = _interopRequireDefault(_validate);
function validateDecorator(fn) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var _validateReturn = require('./validateReturn');
var validators = args.map(function (arg) {
return Array.isArray(arg) ? arg : Array.of(arg);
}).map(function (fns) {
return function (arg) {
return (0, _lodashCollectionEvery2['default'])(fns, function (fn) {
return fn(arg);
});
};
});
var _validateReturn2 = _interopRequireDefault(_validateReturn);
return function validator() {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
validate(args);
return fn.call.apply(fn, [this].concat(args));
};
function validate(args) {
for (var i = 0, len = args.length; i < len; i++) {
if (validators[i] && !validators[i](args[i])) {
throw new TypeError('Argument did not pass validation. Got ' + typeof arg + '.');
}
}
}
}
exports['default'] = (0, _utilsNormalizeExport2['default'])({
validate: _validate2['default'],
validateReturn: _validateReturn2['default']
});
module.exports = exports['default'];
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