Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
(function(global,factory){if(typeof define === "function" && define.amd){define(["exports","module"],factory);}else if(typeof exports !== "undefined" && typeof module !== "undefined"){factory(exports,module);}else {var mod={exports:{}};factory(mod.exports,mod);global.index = mod.exports;}})(this,function(exports,module){"use strict";var _bind=Function.prototype.bind;module.exports = inject;function inject(){var _ref;for(var _len=arguments.length,deps=Array(_len),_key=0;_key < _len;_key++) {deps[_key] = arguments[_key];}deps = (_ref = []).concat.apply(_ref,deps).filter(EXISTS);return function(target,name,descriptor){function diWrapper(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2 < _len2;_key2++) {args[_key2] = arguments[_key2];}var resolved=args.splice(0,deps.length);for(var i=0;i < resolved.length;i++) {target.prototype[deps[i]] = resolved[i];}return new (_bind.apply(target,[null].concat(args)))();}diWrapper.prototype = target.prototype;diWrapper.$inject = deps;return diWrapper;};}var EXISTS=function EXISTS(x){return !!x;};}); | ||
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}(function(global,factory){if(typeof define==="function"&&define.amd){define(["exports"],factory);}else if(typeof exports!=="undefined"){factory(exports);}else{var mod={exports:{}};factory(mod.exports);global.index=mod.exports;}})((typeof globalThis==="undefined"?"undefined":_typeof(globalThis))==="object"?globalThis:(typeof self==="undefined"?"undefined":_typeof(self))==="object"?self:this,function(_exports){"use strict";Object.defineProperty(_exports,"__esModule",{value:true});_exports["default"]=inject;function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true;}catch(e){return false;}}function _construct(Parent,args,Class){if(isNativeReflectConstruct()){_construct=Reflect.construct;}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance");}function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||Object.prototype.toString.call(iter)==="[object Arguments]")return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}}function inject(){var _ref;for(var _len=arguments.length,deps=new Array(_len),_key=0;_key<_len;_key++){deps[_key]=arguments[_key];}deps=(_ref=[]).concat.apply(_ref,_toConsumableArray(deps)).filter(EXISTS);return function(Target,name,descriptor){function diWrapper(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}var resolved=args.splice(0,deps.length);for(var i=0;i<resolved.length;i++){Target.prototype[deps[i]]=resolved[i];}return _construct(Target,args);}diWrapper.prototype=Target.prototype;diWrapper.$inject=deps;return diWrapper;};}var EXISTS=function EXISTS(x){return!!x;};}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "ng-inject", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Decorator that wraps a class in an Angular 1.x DI injector for the given dependencies.", | ||
@@ -8,4 +8,6 @@ "main": "dist/index.js", | ||
"build": "babel src -s -d dist", | ||
"test": "eslint {src,test} && mocha --compilers js:babel/register test/**/*.js", | ||
"prepublish": "npm run build", | ||
"test": "npm run lint && npm run test:unit", | ||
"test:unit": "mocha --require @babel/register test/**/*.js", | ||
"lint": "eslint src test", | ||
"prepublishOnly": "npm run build", | ||
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" | ||
@@ -23,2 +25,5 @@ }, | ||
], | ||
"eslintConfig": { | ||
"extends": "eslint-config-synacor" | ||
}, | ||
"author": "Jason Miller <jason@developit.ca>", | ||
@@ -35,10 +40,16 @@ "license": "BSD", | ||
"devDependencies": { | ||
"babel": "^5.8.23", | ||
"babel-eslint": "^4.1.3", | ||
"chai": "^3.3.0", | ||
"eslint": "^1.7.1", | ||
"mocha": "^2.3.3", | ||
"sinon": "^1.17.1", | ||
"sinon-chai": "^2.8.0" | ||
"@babel/cli": "^7.7.0", | ||
"@babel/core": "^7.7.0", | ||
"@babel/plugin-proposal-decorators": "^7.7.0", | ||
"@babel/plugin-transform-modules-umd": "^7.7.0", | ||
"@babel/preset-env": "^7.7.1", | ||
"@babel/register": "^7.7.0", | ||
"chai": "^4.2.0", | ||
"core-js": "^3.3.6", | ||
"eslint": "^6.6.0", | ||
"eslint-config-synacor": "^3.0.5", | ||
"mocha": "^6.2.2", | ||
"sinon": "^7.5.0", | ||
"sinon-chai": "^3.3.0" | ||
} | ||
} |
# `ng-inject` | ||
[![NPM](http://img.shields.io/npm/v/ng-inject.svg)](https://www.npmjs.com/package/ng-inject) | ||
[![travis-ci](https://travis-ci.org/synacorinc/ng-inject.svg)](https://travis-ci.org/synacorinc/ng-inject) | ||
[![travis-ci](https://travis-ci.org/synacor/ng-inject.svg)](https://travis-ci.org/synacor/ng-inject) | ||
@@ -6,0 +6,0 @@ Decorator that wraps a class in a DI injector for the given dependencies. |
@@ -17,11 +17,11 @@ | ||
return (target, name, descriptor) => { | ||
return (Target, name, descriptor) => { | ||
function diWrapper(...args) { | ||
let resolved = args.splice(0, deps.length); | ||
for (let i=0; i<resolved.length; i++) { | ||
target.prototype[deps[i]] = resolved[i]; | ||
Target.prototype[deps[i]] = resolved[i]; | ||
} | ||
return new target(...args); | ||
return new Target(...args); | ||
} | ||
diWrapper.prototype = target.prototype; | ||
diWrapper.prototype = Target.prototype; | ||
diWrapper.$inject = deps; | ||
@@ -28,0 +28,0 @@ return diWrapper; |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10698
81
13
1