Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jlord/sheetsee-core
Module with core data manipulation functions for sheetsee.js
https://github.com/jlord/sheetsee-core
Last synced: 11 days ago
JSON representation
Module with core data manipulation functions for sheetsee.js
- Host: GitHub
- URL: https://github.com/jlord/sheetsee-core
- Owner: jlord
- License: bsd-2-clause
- Created: 2013-12-15T23:56:12.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-03-29T18:28:30.000Z (over 7 years ago)
- Last Synced: 2024-04-15T09:19:25.117Z (7 months ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 13
- Watchers: 5
- Forks: 20
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-data-ui - sheetsee-core - Module with core data manipulation functions for sheetsee.js (modules for working with excel/google spreadsheets:)
README
[![Standard - JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
# sheetsee-core
This module is included in every Sheetsee build. It contains methods for basic data manipulation you might want to do.
## Working With Your Data
Sheetsee pairs with [Tabletop.js](https://github.com/jsoma/tabletop) which will fetch the data from your spreadsheet and return it as an _array of objects_. You'll use these methods from Sheetsee after you have that data.
## Methods
Here are the functions you can use!
### `Sheetsee.getKeywordCount(data, keyword)`
- `data` _array of objects_
- `keyword` _string_
- Returns _number_Given your **data** and **keyword** to search by, this function returns the number of times it occurs throughout all of the data.
```javascript
getGroupCount(data, 'cat')
// returns a number
```### `Sheetsee.getKeyword(data, keyword)`
- `data` _array of objects_
- `keyword` _string_
- Returns _number_Given your **data** and a **keyword** to search by, this function returns every row which contains a match to the keyword.
```javascript
getKeyword(data, 'cat')
// returns array of objects
```### `Sheetsee.getColumnTotal(data, column)`
- `data` _array of objects_
- `column` _string_
- Returns _number__Use only with columns of numbers_
Given your **data** and **column** header, this function sums each cell in that column and returns the value.
```javascript
getColumnTotal(data, 'cuddlability')
// returns number
```### `Sheetsee.getColumnAverage(data, column)`
- `data` _array of objects_
- `column` _string_
- Returns _number_Given your **data** and **column** header, this function returns the average value of every cell in the column.
```javascript
getColumnAverage(data, 'cuddlability')
// returns number
```### `Sheetsee.getMin(data, column)`
- `data` _array of objects_
- `column` _string_
- Returns _array_Given your **data** and **column** header, this function returns an array of the rows with the lowest values within the specified column.
```javascript
getMin(data, 'cuddlability')
// returns array
```### `Sheetsee.getMax(data, column)`
- `data` _array of objects_
- `column` _string_
- Returns _array_Given your **data** and **column** header, this function returns an array of the rows with the highest values within the specified column.
```javascript
getMin(data, 'cuddlability')
// returns array of objects
```### `Sheetsee.getMatches(data, filter, column)`
- `data` _array of objects_
- `filter` _string_
- `column` _string_
- Returns _array_Takes **data**, a **filter** term to search by within a **column** and returns every row that matches,
```javascript
getMatches(data, 'dog', 'kind')
// returns array of objects
// [{'name': 'coco', 'kind': 'dog'...}, {'name': 'wolfgang', 'kind': 'dog'...},{'name': 'cooc', 'kind': 'dog'...} ]
```### `Sheetsee.getOccurance(data, column)`
- `data` _array of objects_
- `column` _string_
- Returns _object_Takes **data** **column** header and returns an object with key/value pairs of how often an item occurs in the column.
```JAVASCRIPT
getOccurance(data, 'kind')
// Returns an object
// {'dog': 3, 'cat': 3}
```### Math
Don't Forget JavaScript Math! Create variables that are the sums, differences, multiples and so forth of others. Lots of info on that [here on MDN](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math).
```javascript
var profit09 = Sheetsee.getColumnTotal(data, '2009')
var profit10 = Sheetsee.getColumnTotal(data, '2010')
var difference = profit09 - profit10
```