<commit_before># write-umd - Write Universal Module Definition modules with ease

A small libarary that help you to write umd modules. The umd pattern follows the node.js we to write code instead of the require.js. Meaning you write code like this:

	define(function(require, exports, module) {  // this line is included in boilerplate
		var module1 = require('someModule');
	});	// this line is included in boilerplace
	
instead of this:

	define(['someModule'], function(module1) {
		// ...
	});

I believe the node.js way is easier to write because you typically add dependent modules dynamically while you are writing your code. Require.js format either assume that you know what dependencies you need from the beginning, or it is harder to add dependencies later on.

## Installation

	npm install write-umd

## Usage

The easiest way is to use the included live template for phpStorm/webStorm to create the boilerplate for you.

## Test

	npm test

## License
MIT<commit_msg>Update readme with node.js / r.js / require.js usage.<commit_after># write-umd - Write Universal Module Definition modules with ease

A small libarary that help you to write umd modules. The umd pattern follows the node.js we to write code instead of the require.js. Meaning you write code like this:

	define(function(require, exports, module) {  // this line is included in boilerplate
		var module1 = require('someModule');
	});	// this line is included in boilerplace
	
instead of this:

	define(['someModule'], function(module1) {
		// ...
	});

I believe the node.js way is easier to write because you typically add dependent modules dynamically while you are writing your code. Require.js format either assume that you know what dependencies you need from the beginning, or it is harder to add dependencies later on.

## Installation

	npm install write-umd

## Usage

The easiest way is to use the included live template for phpStorm/webStorm to create the boilerplate for you.

### Node.js
At the beginning of your application, require the `write-umd` module before loading other modules written using `write-umd`. Since it does not have any dependency, you can safely require it first before anything else.

	require('write-umd');
	// require other modules
	
It will export umd as a global object, so you don't need to create any variable for it. Optionally, you can still get the instance by `var umd = require('write-umd')`, but it is not really necesary.

### Require.js
You need to load the `write-umd` module before loading other modules that uses it.

### r.js
You can add the `onBuildRead` method from the `r.js/build.js` file to your `build.js`. It will strip out the umd(...) code and make the module work just like any amd module. 

## Test

	npm test

## License
MIT
{'fraction_non_alphanumeric': 0.07189306358381503, 'fraction_numerical': 0.001445086705202312, 'mean_word_length': 3.944642857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6129451', 'n_tokens_mistral': 765, 'n_tokens_neox': 719, 'n_words': 394}