# @xcore24/extended-object-props

> TypeScript library implementing the Extended object properties pattern

Latest version **1.0.2** (published 2022-02-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install @xcore24/extended-object-props
pnpm add @xcore24/extended-object-props
yarn add @xcore24/extended-object-props
bun add @xcore24/extended-object-props
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-02-27 |
| First published | 2022-02-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | A.Koreshkov |
| Maintainers | xcore24 |
| Keywords | extend-props-object, extensibility-object, extended-object-props, additional-object-props, extend-props-object-pattern, extensibility-object-pattern, extended-object-props-pattern, additional-object-props-pattern |

## Links

- npm: https://www.npmjs.com/package/@xcore24/extended-object-props
- npm.io page: https://npm.io/package/@xcore24/extended-object-props

## Recent versions

- 1.0.2 (latest) — 2022-02-27
- 1.0.1 — 2022-02-25
- 1.0.0 — 2022-02-25

## README

# extended-object-props

`extended-object-props` is TypeScript library implementing the Extended object properties pattern.

## Installation

To start using extended-object-props install the npm package:

```bash
npm install @xcore24/extended-object-props
```

## Basic Usage

```ts
import { ExtendObjectProps } from "@xcore24/extended-object-props";

interface IExendedPropertiesClass {
  [key: string | symbol]: any
}

class ClassA implements IExendedPropertiesClass {
  foo: string = 'foo'
  bar: string = 'bar'
}

class ClassZ implements IExendedPropertiesClass {
  a: string = 'aaaa'
  b: string = 'bbb'
}

class ClassB extends ExtendObjectProps {
  constructor(obj: {}) {
    super()
    this.addProps(obj)
    this.addProps(obj, 'obj')
    this.publicProps.add('xyz')
  }

  get xyz() {
    return 'xyz'
  }
}

const objectA = new ClassA()
const objectB = new ClassB(objectA)

const objB = objectB as IExendedPropertiesClass
console.log(objB.foo)
console.log(objB.obj)
console.log(objB.obj.bar)
objB.obj.bar = 'bar2'
console.log(objB.obj.bar)
console.log(JSON.stringify(objectB))

const classZ = new ClassZ()
objB.addProp('z', classZ)
objectB.publicProps.add('z')
console.log(['extended-prop:example:1'], objectB.getProps('z' as never).a)
console.log(['extended-prop:example:2'], objB.z.a)
console.log(JSON.stringify(objB))
```

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