open-index/open-npm huggingface dataset:
npm package: @jadesrochers/checksettings
Description: Check settings object for required members
Author: Jared Desrochers
Latest version: 0.1.3

# Check Settings
Checks whether a settings object has the settings defined by and.  

## Whats the Use?
I found that I kept using code along these lines for checking arguments, so  
I split it out into a little package.

## installation 
npm install @jadesrochers/checksettings  

const check = require('@jadesrochers/checksettings')  

## Usage
```javascript
let reqArray = ['names','of','keys','to','check']
let inputfail = {actual:1, object:2, passed:3, as:4, input:5}
let inputpass = {names:1, of:2, keys:3, to:4, check:5}
```

```javascript
check.checkSettings(reqArray, inputfail)
false
```

```javascript
check.checkSettings(reqArray, inputpass)
true 
```
npm package: @jadesrochers/datapulse
Description: Store data, flushing it periodically
Author: Jared Desrochers
Latest version: 0.1.3

# Data Pulse
Accumulates data inputs and writes them at the configured interval  
using a write function.

It also has a counter function that writes a given log statement  
at the configured number of repetitions.

## Whats the Use?
If data writes are expensive computationally this allows a larger  
number to happen at once. 
Could be useful for db/disk writes to reduce IO frequency even though  
the total size of the data will not change.

## installation 
npm install @jadesrochers/datapulse

const acc = require('@jadesrochers/datapulse')

## Data Accumulator/Writer Usage
This example uses a write function that just writes all the data  
to a file with naming based on the first element.

#### sample write function
This is just a simple file write, but you can build a function  
to do anything with the passed storage array that you want.
```javascript
let writefcn3 = storedArray => require('fs').writeFile(
    'testfile' + storedArray[0] + '.txt',
    JSON.stringify(storedArray,null,1),
    (out) => {}
); 
```
#### create the accumulator
Then create the accumulator, passing the interval and writing function.
var testWrite = acc.storeAndWrite(100, inFcn)

#### run it through a simple test
This should write 10 file, each named with the first number in the array.
```javascript
async function waiter(){
  for(let j = 1; j < 1001; j++){
    await testWrite.add(j) 
  }
}
```

### Currently have to await the write function
The await is needed for when the write function fires.  
The write function is passed the internal storage, so currently you need  
to wait for the write to finish to add/clear this internal storage.  
I might change this to clone and then reset and not wait in the future.

## Counter usage
Very simple; pass the threshold to activate a statement, and the statement.  
Accepts custom log function as optional third argument.

let testcount = acc.counter(1000, 'Test entries counted')
```javascript
for(let j = 1; j < 10001; j++){
  testcount()
}
```
npm package: @jadesrochers/filereworker
Description: Get information on data files, split and preserve headings
Author: Jared Desrochers
Latest version: 0.1.4

# File Reworker
Has a variety of helper functions for working with files to get file stats  
like path,stats, name.
The main functions though are for splitting files by size or by lines  
into smaller files.

## Whats the Use?
The file helpers are just little shortcuts, but the splitting functions  
are used for making very large files into smaller files without breaking  
lines in data such as text,csv.

## installation 
npm install @jadesrochers/filereworker

const filere = require('@jadesrochers/checksettings')

## Usage
There are several ways to split files; by size, number, and cores,  
with each option having size and lines sub options.

### Manually split by size or lines
Split a file into pieces specified by size in Mb.
```javascript
fsplit.splitFileSize('/fake/filename.txt')(10)
```

Split a file into pieces specified by number of lines.
```javascript
fsplit.splitFileLines(['/path/to/fakefile.txt',2500])
```

For both these functions, if the size/lines does not result in evenly  
dividing the file, the last file will be the remainder so the others are equal.  

### Automatic sizing of the splits
For these functions you don't need to provide a size or lines argument, just an indication of which size metric to use.

#### Split into even size/line piece specifying just the number
Specify the number of files, and based on either lines or size
will try and make that exact number as even as possible.
```javascript
fsplit.splitEvenSize('/not/a/real/file.csv')
fsplit.splitEvenLines('/not/a/real/file.csv')
```
#### Split by number of cores
Splits files into pieces based on the number of cores you have minus 1.  
There is a size(S) and lines(L) version based on which will more accurately  
split up the processing workload for the resulting files.  
```javascript
fsplit.splitByCoresS('/not/a/real/file.csv')
fsplit.splitByCoresL('/not/a/real/file.csv')
```

### Helper functions
Some function to do basic path and sizing tasks.

Get file name:
```javascript
fh.getFileName('/path/to/filename.txt')  
>> filename.txt 
```

Get a file path:  
```javascript
filere.getPath('/test/name/file.js')  
>> /test/name
```

Get file name without extension:  
```javascript
fh.nameAndBody('/fake/path/to/fakefile.txt')  
>> fakefile
```

Get file size in Mb:  
```javascript
fh.getFileSizeMb('/not/a/real/file.csv')
```

Get number of lines in file:  
```javascript
fh.getFileLines('/path/to/fakefile.txt')
```