# classroom

> A Ruby-like implementation for ES5

Latest version **0.2.0** (published 2013-07-04) · MIT license · 0 weekly downloads

## Install

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

## 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.2.0 |
| Published | 2013-07-04 |
| First published | 2013-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Xavier Cambar |
| Maintainers | xcambar |
| Keywords | class, classes, ruby, es5, ecascript, 5 |

## Links

- npm: https://www.npmjs.com/package/classroom
- Repository: git@github.com:xcambar/classroom
- Issues: https://github.com/xcambar/classroom/issues
- npm.io page: https://npm.io/package/classroom

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.0 (latest) — 2013-07-04

## README

# ClassRoom

## What is it ?

A implementation of classes in Javascript for ES5 engines.

## Features

* Constructor
* Private members
* Constant members

## Examples

    var classRoom = require('classroom');

    var testClass = classRoom.teach({
      initialize: function (arg1, arg2/* , arg3, ... , argn */) {
        // This is the constructor function
        // Properties added here will be private
        this.privateArg = arg1;
      },
      const: { //Describes the constant members of your instances
        const1: "Awesome, I'm immutable!";
      },
      private: { // Describes the properties that are only visible inside the instance
        pv1: "only the instance methods can see me, sweet!",
        secretFn: function () {
          return "I'm invisible to the outside world.";
        }
      },
      // All the other properties are public instance members
      gimmeSecret: function () {
        return "I'm a getter for a private member: " + this.secretFn();
      }
    });

    var instance = testClass.new();

    instance.const1; // => "Awesome, I'm immutable!"
    instance.const1 = 'new value'; // throws TypeError

    instance.privateArg; // => undefined
    instance.pv1; // => undefined
    instance.privateArg; // => undefined
    instance.secretFn; // => undefined

    instance.gimmeSecret(); // => "I'm a getter for a private member: I'm invisible to the outside world."


## TODO

* Inheritance
* Composition (aka mixins)
* Class members

## Licence

MIT

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