# sphinx

> Recursively merges and guards your objects against unwanted tampering.

Latest version **0.1.2** (published 2014-08-16) · MIT license · 0 weekly downloads

## Install

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

## 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.1.2 |
| Published | 2014-08-16 |
| First published | 2014-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jason Bellamy |
| Maintainers | jasonbellamy |
| Keywords | guard, config, options, object |

## Links

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

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2014-08-16
- 0.1.1 — 2014-04-22
- 0.1.0 — 2014-04-22

## README

# Sphinx [![Build Status](https://travis-ci.org/jasonbellamy/sphinx.png?branch=master)](https://travis-ci.org/jasonbellamy/sphinx)

> Recursively merges and guards your objects against unwanted tampering.


## Features
[Sphinx](https://github.com/jasonbellamy/sphinx) guards your objects during a merge by allowing you to:

- only change the values for properties that exist on the destination object.
- only change the values for properties that are of the same type as the destination object.


## Getting Started

```
npm install --save sphinx
```


## Usage

```javascript
var sphinx = require( "sphinx" );

var destination = { foo: "bar" };
var source      = { foo: "qux" };

var merged = sphinx.merge( destination, source );
//=> { foo: "qux" }
```

## Examples

- Trying to add a property that doesn't exist on the destination object.

```javascript
var destination = { foo: "bar" };
var source      = { baz: "qux" };

var merged = sphinx.merge( destination, source );
//=> [Error: Property "baz" does not exist on destination object]
```

- Trying to merge a property of a mismatched type.

```javascript
var destination = { foo: "bar" };
var source      = { foo: 1 };

var merged = sphinx.merge( destination, source );
//=> [TypeError: Expected property "foo" to be a [object String]]
```


## API

### sphinx.merge( destination, object )

Name           | Type      | Argument     | Default | Description
---------------|-----------|--------------|---------|------------
destination    | `Object`  | `<required>` | `null`   | The destination object.  
source         | `Object`  | `<required>` | `null`   | The source object.


## 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) 2014 [Jason Bellamy ](http://jasonbellamy.com)  
Licensed under the MIT license.

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