ng-required-params
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48944
19
490
52
1