<commit_before># Subjects.ts

Subjects.ts is very simple typescript utilities using Subject pattern (Observer and Observable) based on TSX (JSX).

Main goal of this project is to help web application development without learning huge front end frameworks.

## Install

```cmd
npm install --save subjects-ts
```

## Examples

See example.tsx and example.html for live examples.

### Minimal example of SubjectObject

```js
import * as Subjects from 'subjects-ts';
let sub = Subjects.SubjectObject<string>();
sub('My first SubjectObject');
console.log(sub());
sub.AddCallback(value => console.log('callback1:', value));
sub.AddCallback(value => console.log('callback2:', value));
sub('Callback is called');
console.log(sub());
```

### Minimal example of SubjectArray

```js
import * as Subjects from 'subjects-ts';
let sa = new Subjects.SubjectArray<string>();
sa.Push('a');
let mapped = sa.Map(x => console.log(x));
mapped.AddCallbackToOriginalSubjectArray('Push', str => mapped.ExecuteMapFunction(str));
```

### Browser Example
example.tsx
```jsx
import * as Subjects from 'subjects-ts';

class Todo {
	public Subject = Subjects.SubjectObject<string>();
	public Done = Subjects.SubjectObject<string>();
	public constructor(init?: any) {
		Object.keys(init).forEach(x => this[x](init[x]));
	}
}<commit_msg>Fixed readme<commit_after># Subjects.ts

Subjects.ts is very simple typescript utilities using Subject pattern (Observer and Observable) based on TSX (JSX).

Main goal of this project is to help web application development without learning huge front end frameworks.

## Install

```cmd
npm install --save subjects-ts
```

## Examples

See example.tsx and example.html for live examples.

### Minimal example of SubjectObject

```js
import * as Subjects from 'subjects-ts';
let sub = Subjects.SubjectObject<string>();
sub('My first SubjectObject');
console.log(sub());
sub.AddCallback(value => console.log('callback1:', value));
sub.AddCallback(value => console.log('callback2:', value));
sub('Callback is called');
console.log(sub());
```

### Minimal example of SubjectArray

```js
import * as Subjects from 'subjects-ts';
let sa = new Subjects.SubjectArray<string>();
sa.Push('a');
let mapped = sa.Map(x => console.log(x));
mapped.AddCallbackToOriginalSubjectArray('Push', str => mapped.ExecuteMapFunction(str));
sa.Push('b');
```

### Browser Example
example.tsx
```jsx
import * as Subjects from 'subjects-ts';

class Todo {
	public Subject = Subjects.SubjectObject<string>();
	public Done = Subjects.SubjectObject<string>();
	public constructor(init?: any) {
		Object.keys(init).forEach(x => this[x](init[x]));
	}
}
{'fraction_non_alphanumeric': 0.15074229158736202, 'fraction_numerical': 0.0015226494099733537, 'mean_word_length': 5.7384615384615385, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '7159596', 'n_tokens_mistral': 806, 'n_tokens_neox': 760, 'n_words': 242}