open-index/open-npm huggingface dataset:
npm package: @jamr/sqleasy
Description: A minimal, type-friendly async wrapper for SQLite using `sql-template-tag` and `sqlite3` for Node.js/TypeScript projects.
Author: Jeff Miller
Latest version: 0.2.5

# sqleasy

A minimal, type-friendly async wrapper for SQLite and `sqlite3` for Node.js/TypeScript projects.

## Features

- Async API for SQLite
- Includes a streaming interface for large result sets
- TypeScript support with generics for query results
- Implements explicit resource management (i.e. `await using` syntax)
- Schema initialization support
- Supports two APIs for safe SQL queries, tagged template literals (ala `sql-template-tag`) and string queries with parameter substitution

## Installation

> Don't forget to install `sqlite3`!

```
npm install jamiller619/sqleasy sqlite3
```

## Usage

Create a `db.ts` file:

```ts
import sqleasy from 'sqleasy'

// Initialize the database (optionally with a schema)
const connect = await sqleasy(
  '/path/to/my.db',
  `
  CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
  );
`,
)

// export default connect()
await using db = connect()
```

Now you can reference your db from anywhere in your project:

```ts
import sql from 'sql-template-tag'
import db from './db.ts'

type User = { id: number; name: string }

// Insert a user using query strings and parameter substitution
const userId = await db.run(`INSERT INTO users (name) VALUES (?)`, 'Alice')

// Query a single user with sql tagged template literals
const user = await db.one<User>(
  sql`SELECT * FROM users WHERE name = ${'Alice'}`,
)

// Query all users
const users = await db.many<User>('SELECT * FROM users')

// Stream users
const userStream = db.stream<User>('SELECT * FROM users')

for (const user of userStream) {
  console.log(user.name)
}
```

## API

### `sqleasy(fileName: string, schema?: string): Promise<() => Driver>`

Initializes the SQLite database. Optionally runs a schema SQL string. Returns a function that creates a `Driver` instance.

### `Driver`

A class that wraps a SQLite database connection and provides async methods:

- `exec(sql: string): Promise<void>` — Executes a SQL statement without returning a result.
- `run(sql: Sql | string, ...values: any[]): Promise<number>` — Executes a SQL statement and resolves with the last inserted row ID.
- `one<R>(sql: Sql | string, ...values: any[]): Promise<R | undefined>` — Fetches a single row from the database.
- `many<R>(sql: Sql | string, ...values: any[]): Promise<R[]>` — Fetches all rows from the database.
- `stream<R>(sql: Sql | string, ...values: any[]): DatabaseStream<R>` — Returns a stream for the given SQL query.
- `close(): Promise<void>` — Closes the underlying database.
  Can be used with Explicit Resource Management syntax, i.e. `using`.

## TypeScript Support

- All methods are fully typed.
- Use generics to specify the result row type for `one`,
  `many` and `stream`.

## License

MIT
npm package: @jamr/tachyons.js
Description: Tachyons helper function for JavaScript. Built with PostCSS Modules.
Author: Jeff Miller
Latest version: 1.1.0

# tachyons.js

Easily add [tachyons](https://tachyons.io) to your project when using a bundler. Built with [PostCSS](https://postcss.org) & [PostCSS Modules](https://github.com/css-modules/postcss-modules).

## Setup

The setup is a two-step process:

- Include the `'@jamr/tachyons.js'` file in your JavaScript
  files where needed. This exposes a single function that
  accepts tachyon css class names as a string or array of strings.
- Include, only once, the tachyons css. This can be done via
  an import statement in a css file, or by including it in a
  style tag in your html.

## Example

```javascript
import tachyons from '@jamr/tachyons.js'

const classNames = 'pa3 center sans-serif'
// or
const classNames = ['pa3', 'center', 'sans-serif']

const App = () => <div className={tachyons(classNames)} />
```

and in your a css file:

```css
@import '@jamr/tachyons.js/tachyons.css';
```

### More info

The three main files:

- tachyons.js - The helper file to use in your import statements.
- tachyons.css - The unmodified tachyons.css file that needs to be included in your site/app.
- tachyons.css.json - The JSON mapping with transformed class names generated by PostCSS Modules.