# app-base

> Starter for creating a node.js application with a handful of common methods, like `set`, `get`, and `del`.

Latest version **0.1.1** (published 2015-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install app-base
pnpm add app-base
yarn add app-base
bun add app-base
```

## 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.1 |
| Published | 2015-08-28 |
| First published | 2015-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 105 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | boilerplate, cache, del, get, inherit, methods, set, starter, unset, visit |

## Links

- npm: https://www.npmjs.com/package/app-base
- Repository: https://github.com/jonschlinkert/app-base
- Issues: https://github.com/jonschlinkert/app-base/issues
- npm.io page: https://npm.io/package/app-base

## Dependencies (4)

- [get-value](https://npm.io/package/get-value.md) ^1.1.5
- [set-value](https://npm.io/package/set-value.md) ^0.2.0
- [unset-value](https://npm.io/package/unset-value.md) ^0.1.0
- [define-property](https://npm.io/package/define-property.md) ^0.2.1

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2015-08-28
- 0.1.0 — 2015-08-27

## README

# app-base [![NPM version](https://badge.fury.io/js/app-base.svg)](http://badge.fury.io/js/app-base)

> Starter for creating a node.js application with a handful of common methods, like `set`, `get`, and `del`.

## Install

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i app-base --save
```

## Usage

```js
var Base = require('app-base');
```

## API

### [Base](index.js#L30)

Create an instance of `Base` with optional `options`.

**Params**

* `options` **{Object}**

**Example**

```js
var app = new Base();
app.set('foo', 'bar');
console.log(app.get('foo'));
//=> 'bar'
```

### [.set](index.js#L62)

Assign `value` to `key`.

**Params**

* `key` **{String}**
* `value` **{*}**
* `returns` **{Object}**: Returns the instance for chaining.

**Example**

```js
app.set(key, value);

// also takes an object or array
app.set({name: 'Halle'});
app.set([{foo: 'bar'}, {baz: 'quux'}]);
console.log(app);
//=> {name: 'Halle', foo: 'bar', baz: 'quux'}
```

### [.get](index.js#L88)

Return the stored value of `key`. Dot notation may be used to get [nested property values][get-value].

**Params**

* `key` **{*}**
* `escape` **{Boolean}**
* `returns` **{*}**

**Example**

```js
app.set('foo', 'bar');
app.get('foo');
// => "bar"
```

### [.del](index.js#L108)

Delete `key` from the instance.

**Params**

* `key` **{String}**
* `returns` **{Object}**: Returns the instance for chaining.

**Example**

```js
app.del(); // delete all
// or
app.del('foo');
// or
app.del(['foo', 'bar']);
```

### [.define](index.js#L133)

Define a non-enumerable property on the instance.

**Params**

* `key` **{String}**
* `value` **{any}**
* `returns` **{Object}**: Returns the instance for chaining.

**Example**

```js
// arbitrary `render` function using lodash `template`
define('render', function(str, locals) {
  return _.template(str)(locals);
});
```

### [.visit](index.js#L149)

Visit `method` over the items in the given object, or map
visit over the objects in an array.

**Params**

* `method` **{String}**
* `val` **{Object|Array}**
* `returns` **{Object}**: Returns the instance for chaining.

### [.extend](index.js#L181)

Static method for inheriting both the prototype and static methods of the `Base` class.

**Params**

* `Ctor` **{Function}**: The constructor to extend.

**Example**

```js
function MyApp(options) {
  Base.call(this, options);
}
Base.extend(MyApp);

// Optionally pass another object to extend onto `MyApp`
function MyApp(options) {
  Base.call(this, options);
  Foo.call(this, options);
}
Base.extend(MyApp, Foo.prototype);
```

## Related projects

* [define-property](https://www.npmjs.com/package/define-property): Define a non-enumerable property on an object. | [homepage](https://github.com/jonschlinkert/define-property)
* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`  a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value)
* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value)
* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/app-base/issues/new).

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2015 Jon Schlinkert
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 27, 2015._

[define-property]: https://github.com/jonschlinkert/define-property
[get-value]: https://github.com/jonschlinkert/get-value
[set-value]: https://github.com/jonschlinkert/set-value
[unset-value]: https://github.com/jonschlinkert/unset-value

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