open-index/open-npm huggingface dataset:
npm package: @samsch/eslint-config-default
Description: My personal eslint config.
Author: Samuel Scheiderich
Latest version: 0.1.0

# @samsch/eslint-config-default

My personal eslint config.

Use by adding a `.eslintrc.js` file to your project root with this content:

```js
'use strict';

module.exports = {
  extends: '@samsch/eslint-config-default',
};
```

By default, it's in script (CommonJS) and node env mode. 

```js
  env: {
    node: true,
    es6: true,
  },
  parserOptions: {
    sourceType: 'script',
  },
```

You can change put it in ESM and browser mode by adding this in your .eslintrc.js file

```
  env: {
    node: false,
    browser: true,
    es6: true,
  },
  parserOptions: {
    sourceType: 'module',
  },
```
npm package: @samsch/eslint-default
Description: Use [@samsch/eslint-config-default](https://www.npmjs.com/package/@samsch/eslint-config-default) instead.
Author: Samuel Scheiderich
Latest version: 2.0.1

# Package moved!

Use [@samsch/eslint-config-default](https://www.npmjs.com/package/@samsch/eslint-config-default) instead.

https://github.com/samsch/eslint-config-default
npm package: @samsch/rsm
Description: Modern State management solution designed for React
Author: Samuel Scheiderich
Latest version: 0.0.3

# RSM

A modern state management library designed for React.

## Why

RSM (React State Manager) is a modern library designed using the lessons learned from Flux and Redux, integrating the functionality of Sagas, and using Kefir observables.

## Main features over competing solutions

- Low boilerplate
- Built-in side effect and async handling
- Scalable, reusable functionality modeling
- Lens-based state tree slicing

## What the basics look like

> If you clone the repo, this example can be run with `npm run example-1`.

```jsx
// index.js
import 'babel-polyfill'; // Not needed for modern browsers
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, Rsm } from '@samsch/rsm';
import Counter from './Counter';

const store = createStore({});

ReactDOM.render(
  <Rsm store={store}>
    <Counter />
  </Rsm>,
  document.getElementById('root')
);
```
```jsx
// Counter.js
import React from 'react';
import { makeStateComponent } from './rsm';

const actions = {
  increment: () => state => ({ count: state.count + 1 }),
  decrement: () => state => ({ count: state.count - 1 }),
};

const initialState = { count: 0 };

const State = makeStateComponent({ actions });

const Counter = () => (
  <State initialState={initialState} lens={['defaultCounter']}>
    {(state, actions) => (
      <div>
        <div>
          Count: {state.count}
        </div>
        <div>
          <button type="button" onClick={actions.increment}>+1</button>
          {' '}
          <button type="button" onClick={actions.decrement}>-1</button>
        </div>
      </div>
    )}
  </State>
);
```

## API
> TODO
npm package: @samsch/subscribe-to
Description: A React Higher-order Component which subscribes to a prop to update on changes.
Author: Samuel Scheiderich
Latest version: 0.0.1

# subscribeTo

The subscribeTo React HoC wraps a component and listen for changes on a subscribable prop. When the subscription fires, the HoC forces a new render of the wrapped component. Designed to work with [samsch/subscribe-store](https://github.com/samsch/subscribe-store).

## Installation
Install into your project with `npm i @samsch/subscribe-to` (for Node.js), or `npm i -D @samsch/subscribe-to` (for Webpack/Browserify or other bundled projects).

## Use

The `@samsch/subscribe-to` module has a single default export, which is the `subscribeTo` function.

To use subscribeTo, you pass it a function for retrieving a subscribable from props, returning a function, and then pass the component you want to wrap, returning a new component. 

- `subscribeTo: <(props => store)> => <Component: react-component> => Component: react-component`

subscribeTo expects that the subscribable has two methods: `store.subscribe(<listener: Function>)` and `store.unsubscribe(<listener: Function>)`. Anytime the `listener` function which subscribeTo passes is called by the store, the component will re-render.

The stores created by [samsch/subscribe-store](https://github.com/samsch/subscribe-store) follow this pattern correctly, and the source of the project can be used as an example of a valid store implementation.

### Basic example
```jsx
// createStore from '@samsch/susbcribe-store'
const store = createStore({ data: 0 });

const SomeComponent = props => (
  <span>Data: {props.store.state.data}</span>
);

const SubscribedComponent =
  subscribeTo(props => props.store)(SomeComponent);

ReactDOM.render(<SubscribedComponent store={store} />, rootElement);
```

## ES support
This library is compiled with Babel to support IE11 and last 2 Chrome, Edge, Firefox, and Safari. Publically, it expects ES6 methods/objects to exist (natively or polyfilled). Realistically, you could test it and find that it might work in a pure ES5 environment.

If a case is found which doesn't work in pure ES5 environments, and it doesn't require drastic changes or much uglier code, I'll pull those changes in.

## Getting help
You can frequently find me (samsch) hanging out in ##javascript, #Node.js, and #reactjs on Freenode, especially during US working hours. This is a small library, so it's likely someone else could help you as well if you point them at the source file and your code.

## Contributing
Code is formatted to the local prettier/eslint config.

Run tests once with `npm test`, or continuously with `npm test -- --watch`.

The projects builds with `npm run build`, which is also called on pre-publish.
npm package: @samsch/use-knex-sessions
Description: Sets up `express-session` and `connect-session-knex` with reasonable defaults, and adds `connect-flash`.
Author: Samuel Scheiderich
Latest version: 0.0.2-private

# useKnexSessions

Sets up `express-session` and `connect-session-knex` with reasonable defaults, and adds `connect-flash`.

```js
const express = require('express');
const knexFactory = require('knex');

const useKnexSessions = require('@local/use-knex-sessions');

const knex = knexFactory(require('./knexfile'));
const app = express();

const config = require('config.json'); // gitignore config file

useKnexSessions(app, knex, {
  secret: config.sessionSecret, // Must be a random string at least 16 characters
  cookie: {
    // setting secure to false for development lets you use local http
    // instead of needing https.
    secure: config.env === 'prod',
  },
});
```

The default options passed to `express-session` and `connect-session-knex`:
```js
const defaults = {
  resave: false,
  saveUninitialized: false,
  store: {
    knex, // passed into useKnexSessions
    createtable: false,
  },
  cookie: {
    httpOnly: true,
    secure: true,
    sameSite: 'lax',
  },
}
```