{"library":"my-node-fp","title":"Node.js Functional Programming Utilities","description":"my-node-fp is a utility library for Node.js, currently at version 0.10.3, offering a collection of simple functional programming utilities primarily focused on file system (fs) and path manipulation. It ships with TypeScript types, enhancing developer experience. The library provides both asynchronous and synchronous versions for many file system operations, such as checking file existence or directory status. Key differentiators include specialized path utilities like `replaceSepToPosix` and `win32DriveLetterUpdown`, which abstract away OS-specific path concerns. Given its pre-1.0 versioning, users should anticipate potential API changes in future releases, though it appears to be actively maintained based on its recent version number.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install my-node-fp"],"cli":null},"imports":["import { exists } from 'my-node-fp/fs';","import { isDirectorySync } from 'my-node-fp/fs';","import { basenames } from 'my-node-fp/path';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { exists, isDirectory, isEmptyDir } from 'my-node-fp/fs';\nimport { basenames, replaceSepToPosix } from 'my-node-fp/path';\nimport * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\n\nasync function runExample() {\n  const tempDir = path.join(process.cwd(), 'temp_my_node_fp_test');\n  const tempFile = path.join(tempDir, 'test_file.txt');\n\n  // Ensure temp directory exists and is empty for consistent testing\n  if (await exists(tempDir)) {\n    await fs.rm(tempDir, { recursive: true, force: true });\n  }\n  await fs.mkdir(tempDir, { recursive: true });\n  await fs.writeFile(tempFile, 'Hello, my-node-fp!');\n\n  console.log(`Checking if '${tempDir}' exists: ${await exists(tempDir)}`);\n  console.log(`Checking if '${tempFile}' is a directory: ${await isDirectory(tempFile)}`);\n  console.log(`Checking if '${tempDir}' is empty: ${await isEmptyDir(tempDir)}`); // Should be false now\n\n  const filePath = '/usr/local/bin/node_modules/my-package/index.js';\n  const windowsPath = 'C:\\\\Users\\\\User\\\\Documents\\\\file.txt';\n  console.log(`Basenames of '${filePath}' (excluding '.js'): ${basenames(filePath, '.js')}`);\n  console.log(`Posix path for '${windowsPath}': ${replaceSepToPosix(windowsPath)}`);\n\n  // Cleanup after example\n  await fs.rm(tempDir, { recursive: true, force: true });\n  console.log('Cleanup complete.');\n}\n\nrunExample().catch(console.error);","lang":"typescript","description":"Demonstrates basic asynchronous file system checks and path manipulation utilities, including creating and cleaning up temporary files and directories, and transforming path separators.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}