<commit_before># NamespaceJS

A module management system for Javascript projects the does the dirty work for you.


## The Problem

* As Web Applications become larger and more complex, so too do their code bases.
* Working on a large single file is cumbersome. 
* Manually maintaining multiple files is a dependency nightmare.


## The Solution

A **module management system** that does the hard work of dependency management for you.


### What NamespaceJS Provides

1. **Definition Boilerplate** - An AMD-like boiler plate for defining files/modules and their dependencies.
2. **Compiler** - A NodeJS script to compile your Javascript files and modules into a single file.


### How Does NamespaceJS Differ From AMD (Asynchronous Module Definition)?

* **NamespaceJS is not a script loader** - Instead of loading scripts as modules are required, NamespaceJS builds (and optionally minifies) all your scripts into a single file that is loaded with the page.


## Requirements

* [NodeJS](http://nodejs.org/) (to run the build script).


## Installation

1. Make a directory where you wish to store the repository.
```
mkdir ~/GitHub
```
2. Change into the directory you just made.
```
cd ~/GitHub
```
3. Clone the NamespaceJS repository into your directory.
```
git clone <EMAIL>:SamHowie/Namespace.js.git
```


## Usage

### Step One - Define Your Modules

#### **file:** myproject/src/Farmyard/Cow.js
```javascript
Namespace.define({
    namespace: "Farmyard",
    name: "Cow",
    definition: function () {
        var Cow = function Cow() {};
        Cow.prototype.speak = function speak() {
            console.log("Moo!");
        };
        return Cow;
    }
});
```

#### **file:** myproject/src/Farmyard/Pig.js
```javascript
Namespace.define({
    namespace: "Farmyard",
    name: "Pig",
    definition: function () {
        var Pig = function Pig() {};
        Pig.prototype.speak = function speak() {
            console.log("Oink!");
        };
        return Pig;<commit_msg>- README update.<commit_after># NamespaceJS

A module management system for Javascript projects the does the dirty work for you.


## The Problem

* As Web Applications become larger and more complex, so too do their code bases.
* Working on a large single file is cumbersome. 
* Manually maintaining multiple files is a dependency nightmare.


## The Solution

A **module management system** that does the hard work of dependency management for you.


### What NamespaceJS Provides

1. **Definition Boilerplate** - An AMD-like boiler plate for defining files/modules and their dependencies.
2. **Compiler** - A NodeJS script to compile your Javascript files and modules into a single file.


### How Does NamespaceJS Differ From AMD (Asynchronous Module Definition)?

* **NamespaceJS is not a script loader** - Instead of loading scripts as modules are required, NamespaceJS builds (and optionally minifies) all your scripts into a single file that is loaded with the page.


## Requirements

* [NodeJS](http://nodejs.org/) (to run the build script).


## Installation

1. Make a directory where you wish to store the repository.
```
mkdir ~/GitHub
```
2. Change into the directory you just made.
```
cd ~/GitHub
```
3. Clone the NamespaceJS repository into your directory.
```
git clone <EMAIL>:SamHowie/Namespace.js.git
```


## Usage

### Step One - Define Your Modules

In order to be compiled properly, Javascript files must be saved in your source directory under a folder structure that matches your namespace. For example the script for the module named 'MyModule' at namespace 'Foo.Bar' is found at src/Foo/Bar/MyModule.js.

#### **file:** myproject/src/Farmyard/Cow.js
```javascript
Namespace.define({
    namespace: "Farmyard",
    name: "Cow",
    definition: function () {
        var Cow = function Cow() {};
        Cow.prototype.speak = function speak() {
            console.log("Moo!");
        };
        return Cow;
    }
});
```

#### **file:** myproject/src/Farmyard/Pig.js
```javascript
Namespace.define({
    namespace: "Farmyard",
    name: "Pig",
    definition: function () {
        var Pig = function Pig() {};
        Pig.prototype.speak = function speak() {
            console.log("Oink!");
        };
        return Pig;
{'fraction_non_alphanumeric': 0.10977620730270907, 'fraction_numerical': 0.002355712603062426, 'mean_word_length': 3.413721413721414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '32875', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1137, 'n_words': 490}