# sb-data-utils

> A few convenient data manipulation functions.

Latest version **1.0.1** (published 2015-06-22) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install sb-data-utils
pnpm add sb-data-utils
yarn add sb-data-utils
bun add sb-data-utils
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-06-22 |
| First published | 2015-06-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Will Jones |
| Maintainers | wjones127 |
| Keywords | data |

## Links

- npm: https://www.npmjs.com/package/sb-data-utils
- Repository: https://github.com/wjones127/sb-data-utils
- Homepage: https://github.com/wjones127/sb-data-utils#readme
- Issues: https://github.com/wjones127/sb-data-utils/issues
- npm.io page: https://npm.io/package/sb-data-utils

## Dependencies (2)

- [chai](https://npm.io/package/chai.md) ^3.0.0
- [moment](https://npm.io/package/moment.md) ^2.10.3

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-06-22
- 1.0.0 — 2015-06-17

## README

# SB Data Utilities
## Version 1.0.0
This small javascript library provides a few useful functions for working with
data in javascript. It is supplied as a node module. Data is assumed to be given
in the format of an array of objects, each of which have the same properties.

### Setup
While in you project's directory, install the node package with
`npm install sb-data-utils`.

Then, to use the script in a node module, require it with,
```javascript
var DU = require('sb-data-utils');
```

To use the script in a browser app, first load the script with,
```html
<script src="node_modules/sb-data-utils/dist/data-utils.min.js"></script>
```
and then the libraries methods will be available through the `DU` variable.

### Methods
Here are some brief descriptions of the methods. For in-depth documentation of
the methods provided in the module, checkout the JSDoc output at `out/index.html`. 

__`DU.find(array, property, query)`__: Returns the first element in the
`array` whose property `property` matches `query`.

__`DU.select(array, variable)`__: Returns a simple array based giving the
values of the property `variable` in the data set `array`.

__`DU.copy(data)`__: Creates a copy of a data set. This create a new array
with new elements, but the property values of each element are not duplicated.

__`DU.fill(data, input, defaults, start, end)`__: Fills in missing
observations in the data set `data`, based on missing integer values in the
property `input` in the range `[start, end]`. `defaults` gives values for other
properties in the missing observations. This function is useful for filling in
data sets where data for particular years are missing.

__`DU.cumulative(data, input, output, baseline)`__: Adds a new variable to
a data set `data` called `output` which describes the cumulative count of a
variable called `input`, where `baseline` is the value before any growth
occurred.

__`DU.percentGrowth(data, input, output, trim)`__: Adds a new variable to a
data set `data` called `output` which describes the percentage growth based on a
variable called `input`. By default will trim off the first observation.

## Future Version Plans
## 1.0.1

- Implement new `fill` method that will also work well with filling in dates.
- Create a deep-copy option in the `copy` method.
- Figure out better handling of trimming growth data.

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