open-index/open-npm huggingface dataset:
npm package: @noahvarghese/logger
Description: Custom logger for nodejs
Author: Noah Varghese
Latest version: 1.0.0

![Typescript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
<br />
![npm](https://badges.aleen42.com/src/npm.svg)
<br />
<br />
![Continuous Deployment](https://github.com/noahvarghese/logger/actions/workflows/cd.yaml/badge.svg)
<br />
![Continuous Integration](https://github.com/noahvarghese/logger/actions/workflows/ci.yaml/badge.svg)
<br />
<br />
![Statements](https://img.shields.io/badge/statements-96.77%25-brightgreen.svg?style=flat)
<br/>
![Lines](https://img.shields.io/badge/lines-98.18%25-brightgreen.svg?style=flat)
<br/>
![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat)
<br/>
![Branches](https://img.shields.io/badge/branches-89.28%25-yellow.svg?style=flat)
<br/>
<br/>
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
<br />
<br />

<img src="https://raw.githubusercontent.com/noahvarghese/logger/main/assets/log.png" width="100" alt="log" />

# Logger

Javascript/Typescript logger. Basic right now, just used to share implementation across projects. At some point may be able to store logs instead of just outputting to std{err,out}.

## Installation

```bash
npm i @noahvarghese/logger
```

## Usage

```typescript
import Logger from "@noahvarghese/logger";

// Typically set in a .env file, on deployment, or within CI
process.env["LOG_LEVEL"] = 7;

/**
 * Setting the environment variable LOG_LEVEL dictates which logging calls will be output
 * The numbers are the environment variable options
 * -1 to disable all
 *
 * enum LogLevel {
 * ERROR=0,
 * TEST=1,
 * WARN=2,
 * DEBUG=3,
 * LOG=4,
 * CMD=5,
 * SQL=6
 * }
 *
 */

// Can override environment and turn off all logs by passing true to the init function
const disableLogs = false;

// Required to load environment variable into class
Logs.init(disableLogs);

// Sample calls and output
Logs.Error("error"); // [ ERROR ]: error [path to function where error ocurred]

Logs.Test("test"); // [ TEST ]: test [path to function where error ocurred]

Logs.Warn("warn"); // [ WARN ]: warn [path to function where error ocurred]

Logs.Debug("debug"); // [ DEBUG ]: debug [path to function where error ocurred]

Logs.Log("log"); // [ LOG ]: log

Logs.Cmd("cmd"); // [ CMD ]: cmd

Logs.Sql("sql"); // [ SQL ]: sql
```

## Development - Getting Started

```bash
git clone https://github.com/noahvarghese/logger
cd ./logger
npm i
# Configures pre commit hook and shell preferences
npm run init
```
npm package: @noahwitt/binary-search-tree
Description: documentation in ["docs"](docs/globals.md)
Author: Noah Witt
Latest version: 1.0.1

# typescript binary search tree
## By Noah Witt

documentation in ["docs"](docs/globals.md)

NPM: https://www.npmjs.com/package/@noahwitt/binary-search-tree
github: https://github.com/noah-witt/binary-search-tree
install by running `npm i --save @noahwitt/binary-search-tree`
npm package: @noahyu/conventional-changelog-base
Description: noahyu preset for conventional-changelog.
Author: Noah Yu
Latest version: 1.1.2

# @noahyu/conventional-changelog-base

## Usage

```bash
pnpm add @noahyu/conventional-changelog-base -D

# Or yarn add -D / npm install -D
```

## Quick start

```js
// changelog.config.mjs
import createPreset from '@noahyu/conventional-changelog-base'

export default createPreset
```

```json
// package.json
{
  // ···
  "scripts": {
    // ···
    "changelog": "conventional-changelog -n './changelog.config.js' -i CHANGELOG.md -s -r 0 -k ./package.json --commit-path ./"
  }
  // ···
}
```

## License

[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2024-present, Noah Yu
npm package: @noahyu/eslint-config-nest
Description: ESlint config for NestJS
Author: Noah Yu
Latest version: 1.4.4

# @noahyu/eslint-config-nest

> ESlint config for NestJS

## Usage

```bash
pnpm add @noahyu/eslint-config-nest
```

## Quick start

```js
// eslint.config.mjs
import noahyuConfig from '@noahyu/eslint-config-nest'

export default [
  ...noahyuConfig,
  // anything from here will override noahyuConfig
  {
    rules: {
      // ···
    },
  },
]
```

## License

[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2023-present, Noah Yu
npm package: @noahyu/eslint-config-vue
Description: ESlint config for Vue 3 + TypeScript
Author: Noah Yu
Latest version: 1.4.4

# @noahyu/eslint-config-vue

> ESlint config for Vue 3 + TypeScript

## Usage

```bash
pnpm add @noahyu/eslint-config-vue
```

## Quick start

```js
// eslint.config.mjs
import noahyuConfig from '@noahyu/eslint-config-vue'

export default [
  ...noahyuConfig,
  // anything from here will override noahyuConfig
  {
    rules: {
      // ···
    },
  },
]
```

## License

[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2023-present, Noah Yu
npm package: @noahyu/nuxt-fetch
Description: Secure and easy http proxy integration with Nuxt.js
Author: Noah Yu
Latest version: 2.0.1

# @noahyu/nuxt-fetch

## Usage

```bash
npm install @noahyu/nuxt-fetch --save
# or
pnpm add @noahyu/nuxt-fetch -P
```

## Quick start

```ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    [
      '@noahyu/nuxt-fetch',
      {
        '/api': {
          pathRewrite: {
            '^/api': 'api',
          },
          apiHostEnv: 'API_HOST',
          apiHostUrl: 'http://api.com',
          cookieName: 'access_token',
        },
        '/api2': {
          pathRewrite: {
            '^/api2': '/api',
          },
          apiHostEnv: 'API_HOST',
          apiHostUrl: 'http://api2.com',
          cookieName: 'access_token',
        },
      },
    ],
  ],
})
```

```ts
const { data, pending, error, refresh } = await useFetch('/api/example')

// http://localhost/api/example => http://myapi.com/api/example
```

## License

[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2023-present, Noah Yu
npm package: @noahyu/nuxt-route
Description: Secure and easy route ability integration with Nuxt.js
Author: Noah Yu
Latest version: 2.0.1

# @noahyu/nuxt-route

> Secure and easy route ability integration with Nuxt.js

## Usage

```bash
npm install @noahyu/nuxt-route --save
# or
pnpm add @noahyu/nuxt-route -P
```

## Quick start

### Basic Configuration

```ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    [
      '@noahyu/nuxt-route',
      {
        // 需要鉴权的 URL
        // 如果使用 `/` 结束，则以该标识开头的 URL 都需要登录后才能访问
        authPath: ['/order', '/personal/'],

        // 登录页的 URL
        loginPath: '/login',

        // 根据所提供的 name，从 cookie 中获取 value
        // 如果 value 存在，则认为当前为登录状态
        cookieName: 'access_token',

        // 已登录状态下不允许访问的 URL
        // 例如：登录、注册页面，已登录状态访问这些页面将重定向到首页
        excludePath: ['/login', '/register'],

        // 您可以自定义 token 验证函数，当遇到需要鉴权的 URL 时，会执行该函数并且当返回 true 时通过验证
        validateToken: (token) => !!token,
      },
    ],
  ],
})
```

### Helper

- `useToLogin(fullPath: string, open?: '_blank'): void`
  - 记住 URL 并跳转到登录页
  - 登录成功后如果调用了 `useLoginSuccess` 将跳转到记住的 URL 地址
  - param `open` 是否新窗口(标签页)打开

```ts
// 记住 `/about` 并跳转到登录页
useToLogin('/about')
```

- `useLoginSuccess(token: string, options?: CookieOptions | string, to?: string): void`
  - 登录成功后调用，保存 `token` 到 cookie 以及执行页面跳转
  - `token` 将要写入 cookie 的值， name 为 `nuxtRoute.cookieName`
  - `options` 当为 `object` 类型时，作为 `useCookie` 的 `options`；当为 `string` 类型时，作为跳转的 URL 地址
  - `to` 跳转到该 URL 地址。具有最高优先级，哪怕 `options` 为 `string` 类型
  - 当 `options` 不为 `string` 类型，且 `to` 不存在时，则判断是否存在被拦截的 URL 或被 `useToLogin` 记录的 URL，存在则跳转到该 URL 地址，不存在则跳转到首页

```ts
const login = (token) => {
  // options 为 useCookie 的第二个参数，用于设置 cookie 的其他属性
  const options = {
    maxAge: 3600,
  }

  useLoginSuccess(token, options)
}
```

## License

[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2023-present, Noah Yu
npm package: @noahyu/project-cli
Description: Command line interface (CLI) for quick project creation
Author: Noah Yu
Latest version: 1.2.0

# project-cli

> Helps you quickly create out-of-the-box projects

## Usage

```bash
npm install @noahyu/project-cli -g
```

## Quick start

```bash
pcli create <app-name>
```

## License

[MIT](https://opensource.org/licenses/MIT)

Copyright (c) 2023-present, Noah Yu