open-index/open-npm huggingface dataset:
npm package: @satvik-s/http2-client
Description: node http2 wrapper
Author: Satvik Shukla
Latest version: 0.1.2

<div>
  <br />
    <img width="250" src="https://github.com/satvik-s/http2-client/blob/main/docs/images/http2-client.png?raw=true">
  <p />
</div>

# http2-client

[![npm](https://img.shields.io/npm/v/@satvik-s/http2-client)](https://www.npmjs.com/package/@satvik-s/http2-client)
[![David](https://img.shields.io/david/satvik-s/http2-client)](https://www.npmjs.com/package/@satvik-s/http2-client)
[![node-current](https://img.shields.io/node/v/@satvik-s/http2-client)](https://www.npmjs.com/package/@satvik-s/http2-client)
[![Snyk Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/satvik-s/http2-client)](https://www.npmjs.com/package/@satvik-s/http2-client)
[![GitHub](https://img.shields.io/github/license/satvik-s/http2-client)](https://github.com/satvik-s/http2-client)

_An opinionated HTTP/2 wrapper around native NodeJS module_

__http2-client__ provides a simple and accessible interface to make HTTP/2 requests to servers.

## How it works

The `Http2Client` class provides ability to the user to create instances of an HTTP/2 client which
can then be leveraged to call single/multiple APIs, single/multiple times over its lifetime.

## Examples

### GET Request

```typescript
import { Http2Client } from '@satvik-s/http2-client';

const client = new Http2Client('https://test-service.com');
const resp = await client.request({
    method: 'GET',
    scheme: 'https',
    path: '/v1/test-api',
});

console.log('status', resp.statusCode);
console.log('body', resp.body);
console.log('headers', resp.headers);
```

### POST Request

```typescript
import { Http2Client, PayloadType } from '@satvik-s/http2-client';

const client = new Http2Client('https://test-service.com');
const resp = await client.request({
    method: 'POST',
    scheme: 'https',
    path: '/v1/test-api',
    body: {
        type: PayloadType.JSON,
        data: {
            hello: 'world',
        }
    },
});

console.log('status', resp.statusCode);
console.log('body', resp.body);
console.log('headers', resp.headers);
```

## Contributing

Contributions are welcome! Read `CONTRIBUTING.md` for more details.
npm package: @satvik2101/lucid
Description: A (one of many) HTML templating engine that produces static HTML files. At it's core it's a new way to write HTML. 
Author: satvik2101
Latest version: 0.1.1

# lucid

A (one of many) HTML templating engine that produces static HTML files.
Based entirely on TypeScript. At it's core it's a new way to write HTML. 

```html
<a href="www.google.com" rel="nofollow" target="_blank">Google</a>
```

becomes

```ts

new A().href("www.google.com").rel("nofollow").target("_blank").populate("Google")

```

The `populate` function is used to set the children of the tag. It takes an array of strings or tags, or a mixture. It can also take a single string or tag.

You can also use the shorthand `p` function to populate the tag.


The `toString()` function will return the HTML string.

All the HTML tags have been implemented as subclasses of the parent class `Tag`.

## Examples

### Basic

```ts
import A from "./tags/A";

const a = new A().href("www.google.com").rel("nofollow").target("_blank").p("Google")

console.log(a.toString())
```


### Nesting

```ts

import A from "./tags/A";
import Div from "./tags/Div";

const div = new Div().class("link-container").populate(
    new A().href("www.google.com").rel("nofollow").target("_blank").p("Google"),
    new A().href("www.github.com").rel("nofollow").target("_blank").p("Github")
)

console.log(div.toString())

```

### Nesting with text

```ts

import A from "./tags/A";
import Div from "./tags/Div";

const div = new Div().class("link-container").populate(
    new A().href("www.google.com").rel("nofollow").target("_blank").p("Google"),
    "This is some text",
    new A().href("www.github.com").rel("nofollow").target("_blank").p("Github")
)

console.log(div.toString())

```

There are also some convenience tags that make using them easier. For example, the `EnhancedDiv` class takes arguments for class, id, and content. Similarly, the `EnhancedImg`,`EnhancedScript`,`SimpleAnchor` tag provide convenience methods for common attributes.


Example for `EnhancedDiv`:

```ts
import EnhancedDiv from "./urils/EnhancedDiv";

const div = new EnhancedDiv({
    id:"my-id",
    class:"my-class",
    children:[
        "This is some text",
        new A().href("www.google.com").p("Google"),
    ]
})



```

While most attributes listed in the MDN docs have their own functions, if there's an attribute that doesn't have a function, you can use the `setAttr` function to set it.

```ts
import A from "./tags/A";

const a = new A().setAttr("data-foo","bar").p("Google")
```


For a more comprehensive example, see the [website branch](https://github.com/Satvik2101/lucid/tree/website) of this repo. It uses Lucid to generate the code for [my website](https://www.satvikgupta.com)

You can also view the Website code [here](https://github.com/Satvik2101/portfolio). But that also contains other stuff (AWS stuff and other things) that you might not want to see.