<commit_before># Structs for JavaScript inspired by Ruby

[Ruby Structs](http://www.ruby-doc.org/core-1.9.3/Struct.html) are an awesome way to add several attributes to a class. Inspired by these, *Strukt* provides a similiar minimalistic API for JavaScript in the browser and in Node.

## Installation

- **Node**: `$ npm install strukt.js`
  ```js
  var Struct = require('strukt.js');
  ```

- **Browser**: Grab [lib/strukt.js](https://raw.github.com/js-coder/strukt.js/master/lib/strukt.js) and include it in your HTML document.

  A global `Struct` function will be added. AMD and CommonJS loaders are also supported.

- - -

## Basic structs

Simple. Pass the parameters you want to `Struct`, a new constructor function will be returned.

```js
var Point = new Struct('x', 'y');
var p = new Point(42, 1337);
p.x; // 42
p.y; // 1337
```

Prefer CoffeeScript?

```coffeescript
class Point extends new Struct 'x', 'y'
  # More class logic<commit_msg>fix: forgot to rename some stuff<commit_after># Structs for JavaScript inspired by Ruby

[Ruby Structs](http://www.ruby-doc.org/core-1.9.3/Struct.html) are an awesome way to add several attributes to a class. Inspired by these, *Strukt* provides a similiar minimalistic API for JavaScript in the browser and in Node.

## Installation

- **Node**: `$ npm install strukt`
  ```js
  var Struct = require('strukt');
  ```

- **Browser**: Grab [lib/strukt.js](https://raw.github.com/js-coder/strukt.js/master/lib/strukt.js) and include it in your HTML document.

  A global `Struct` function will be added. AMD and CommonJS loaders are also supported.

- - -

## Basic structs

Simple. Pass the parameters you want to `Struct`, a new constructor function will be returned.

```js
var Point = new Struct('x', 'y');
var p = new Point(42, 1337);
p.x; // 42
p.y; // 1337
```

Prefer CoffeeScript?

```coffeescript
class Point extends new Struct 'x', 'y'
  # More class logic
{'fraction_non_alphanumeric': 0.13302034428794993, 'fraction_numerical': 0.01564945226917058, 'mean_word_length': 3.8434343434343434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5461706', 'n_tokens_mistral': 644, 'n_tokens_neox': 608, 'n_words': 234}