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

ng-required-params

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-required-params - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

coverage/coverage-final.json

12

bower.json

@@ -13,5 +13,2 @@ {

"license": "MIT",
"dependencies": {
"angular": "*"
},
"moduleType": [

@@ -31,10 +28,9 @@ "amd",

".babelrc",
".editorconfig",
".npmignore",
".travis.yml",
"node_modules",
".editorconfig",
"bower.json",
"karma.conf.js",
"LICENSE",
"package.json",
"README.md"
"package.json"
]
}
{
"name": "ng-required-params",
"version": "0.1.2",
"version": "0.1.3",
"description": "Enforce required method parameters in angular",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -27,15 +27,17 @@ # ng-required-params

```javascript
angular.module('MyApp', ['ng-required-params'])
angular
.module('MyApp', ['ng-required-params'])
.controller('MyController', ['$scope', 'ngRequired', function ($scope, ngRequired) {
$scope.incrementCounter = (counter = ngRequired`counter`) => {
return counter++;
};
$scope.incrementCounter = (counter = ngRequired`counter`) => {
console.log('Current count: ' + counter++);
};
$scope.incrementCounter(); // ==> Error: Missing parameter: counter
}]);
$scope.incrementCounter(5); // Logs ==> Current count: 6
$scope.incrementCounter(); // Error ==> Missing parameter: counter
}]);
```
Since required parameters are fundamental and may be often used, it makes sense to make the call to the service as short
and easy-to-type as possible. Therefore it is recommended to use template literal syntax `foo´string´` for calling
`ngRequired` instead of the normal round brackets syntax `foo('string')`. You may also want to import the module as
`ngReg` or `req` instead of `ngRequired` to save more keystrokes.
ngRequired instead of the normal round brackets syntax `foo('string')`. You may also want to name the imported module as
"ngReg" or "req" instead of "ngRequired" to save even more keystrokes.

@@ -42,0 +44,0 @@ ### Use with a module loader

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