{"size": 668, "ext": "js", "max_stars_repo_path": "src/es7/decorators/factory.js", "max_stars_repo_name": "ex-machine/ng-classes", "max_stars_repo_stars_event_min_datetime": "2016-02-02T10:48:45.000Z", "max_stars_repo_stars_event_max_datetime": "2016-02-03T17:42:45.000Z", "max_issues_repo_path": "src/es7/decorators/factory.js", "max_issues_repo_name": "ex-machine/ng-classes", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/es7/decorators/factory.js", "max_forks_repo_name": "ex-machine/ng-classes", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.8571428571, "max_line_length": 66, "alphanum_fraction": 0.6661676647}
export function factory(target) {
	if (target.hasOwnProperty('$$classified'))
		return target;

	let wrapper = (...deps) => new target(...deps);

	if (Object.setPrototypeOf) {
		Object.setPrototypeOf(wrapper, Object.getPrototypeOf(target)); 
	} else {
		angular.extend(wrapper, target);
	}

	let props = Object.getOwnPropertyNames(target);

	for (let i = 0; i < props.length; i++) {
		let prop = props[i];
		let descriptor = Object.getOwnPropertyDescriptor(target, prop);

		if (descriptor) {
			Object.defineProperty(wrapper, prop, descriptor);
		}
	}

	// compatibility with ng-classified	
	wrapper.$$classified = null;

	return wrapper;
}