# telescope

> An observable module for objects and arrays

Latest version **0.2.0** (published 2013-12-22) · 0 weekly downloads

## Install

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

## 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-12-22 |
| First published | 2013-12-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Author | parroit |
| Maintainers | parroit |

## Links

- npm: https://www.npmjs.com/package/telescope
- Repository: https://github.com/parroit/telescope
- Issues: https://github.com/parroit/telescope/issues
- npm.io page: https://npm.io/package/telescope

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ~2.4.1

## Recent versions

- 0.2.0 (latest) — 2013-12-22
- 0.1.0 — 2013-12-10

## README

# telescope
[![Build Status](https://secure.travis-ci.org/parroit/telescope.png?branch=master)](http://travis-ci.org/parroit/telescope)  [![Npm module](https://badge.fury.io/js/telescope.png)](https://npmjs.org/package/telescope) [![Code Climate](https://codeclimate.com/github/parroit/telescope.png)](https://codeclimate.com/github/parroit/telescope)

An observable module for objects and arrays

## Getting Started
Install the module with: `npm install telescope --save`

### To create an array observable:

```javascript
makeArrayObservable = require("telescope").array;

var tabs = [],
    observableTabs = makeArrayObservable();

observableTabs.init(tabs);
```

`observableTabs` is an array that emits events on push or remove of items.

When you push or remove items to observableTabs, they are pushed or removed from tabs array,
plus a "changed" event is emitted.

Pushing method create also an object observable on pushed item,
that is returned from the function.


### To create an object observable:

```javascript
    var Observable = require("telescope").object;

    function ConcreteObservable(observed){
        this.init(observed);
    }
    ConcreteObservable.prototype = new Observable();

    var anObject = {
       field1:1,
       field2:2
    };
    var observable = new ConcreteObservable(anObject);
```

`observable` is now an object that wrap `anObject` and create a
property for each of its property.

These property set and get values of corresponding `anObject` property,
emitting "changed" events when property values are set.

The init pattern allow to setup derived property that
are set on main property change, e.g. sum, totals, etc.


## Examples
See test folder for more usage exmaples

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style.
Add unit tests for any new or changed functionality.


## License
Copyright (c) 2013 parroit  
Licensed under the MIT license.

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