StringToBoolean (utils/helper.ts)

movinin · backend/src/utils/helper.ts · typescript · MIT
payments

TypeScript utilities for string conversion, file handling, and payment formatting.

// Source: https://github.com/aelassas/movinin | License: MIT | Copyright 2023-2025 Akram El Assas
// Provided via justclaw.it.com; keep this notice with the code.
import { constants } from 'node:fs'
import asyncFs from 'node:fs/promises'
import path from 'node:path'
import mongoose from 'mongoose'
import validator from 'validator'
import Stripe from 'stripe'
import { nanoid } from 'nanoid'

/**
 * Convert string to boolean.
 *
 * @export
 * @param {string} input
 * @returns {boolean}
 */
export const StringToBoolean = (input: string): boolean => {
  try {
    return Boolean(JSON.parse(input.toLowerCase()))
  } catch {
    return false
  }
}

/**
 * Check if a file or a folder exists.
 *
 * @export
 * @async
 * @param {string} filePath
 * @returns {Promise<boolean>}
 */
export const pathEx

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key