# mix_factory

> A basic class factory to allow mixing and matching of prototype functions

Latest version **0.0.1** (published 2015-02-20) · LGPL license · 0 weekly downloads

## Install

```sh
npm install mix_factory
pnpm add mix_factory
yarn add mix_factory
bun add mix_factory
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2015-02-20 |
| First published | 2015-02-20 |
| Weekly downloads | 0 |
| License | LGPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | bobbwhy |
| Keywords | mixin, class, factory, class, object, oriented, prototype |

## Links

- npm: https://www.npmjs.com/package/mix_factory
- npm.io page: https://npm.io/package/mix_factory

## Recent versions

- 0.0.1 (latest) — 2015-02-20

## README

**Mix Factory**

Just two functions to make creating mixins more convenient.

*mix(targetObject, method_name, method, enumerable, writable);*
Adds method, method_name to the target object's *prototype*.  enumerable and writable and
optional and default to false. returns the targetObject after alteration.

	- example
	function Hi(){};
	function there(){return "there"};
	
	// adds there to Hi.prototype
	Hi = mix(Hi, "there", there);
	
	// ....which is the same as ( both set enumerable and writable = false);
	Hi = mix(Hi, "there", there, false, false);

	// you could also: and set enumerable and writable to true;
	Hi = mix(Hi, "there", there, true, true);


*mixSet(targetObject, methodsInfo);*
Adds multiple methods to the target object.  Simply calls mix multiple times on the same object.  
- methodsInfo argument is an array containing arrays of arguments to be passed to the mix function.


	- example
	function Hi(){};
	function there(){return "there"};
	function hi(){return "hi"};
	function blam(){return "blam"}
	
	// adds there to Hi.prototype
	Hi = mixSet(Hi, [ 
			["there", there],
			["blam", blam, false, false],
			["hi", hi, true, false]
		]
	);

	// which is the same as running these commands
	Hi = mix(Hi, "there", there);
	Hi = mix(Hi, "blam", blam, false, false);
	Hi = mix(Hi, hi, true, false);

---
_Source: https://npm.io/package/mix_factory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
