Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@devup-api/utils

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devup-api/utils - npm Package Compare versions

Comparing version
0.1.2
to
0.1.3
+1
-1
package.json
{
"name": "@devup-api/utils",
"version": "0.1.2",
"version": "0.1.3",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "type": "module",

# @devup-api/utils
Common utility package for devup API
Utility functions for OpenAPI processing and file operations.
Provides file creation and common utility functions.
## Installation

@@ -13,6 +11,48 @@

## Exports
### Case Conversion Functions
- `toCamel(str: string): string` - Convert string to camelCase
- `toSnake(str: string): string` - Convert string to snake_case
- `toPascal(str: string): string` - Convert string to PascalCase
### File Operations
- `readOpenapi(filePath?: string): OpenAPIV3_1.Document` - Read and parse OpenAPI JSON file (synchronous)
- `readOpenapiAsync(filePath?: string): Promise<OpenAPIV3_1.Document>` - Read and parse OpenAPI JSON file (asynchronous)
- `writeInterface(filePath: string, content: string): void` - Write TypeScript interface file (synchronous)
- `writeInterfaceAsync(filePath: string, content: string): Promise<void>` - Write TypeScript interface file (asynchronous)
- `createTmpDir(tempDir?: string): string` - Create temporary directory (synchronous)
- `createTmpDirAsync(tempDir?: string): Promise<string>` - Create temporary directory (asynchronous)
## Usage
```typescript
import { createFile, formatPath } from '@devup-api/utils';
### Case Conversion
```ts
import { toCamel, toSnake, toPascal } from '@devup-api/utils'
toCamel('hello_world') // 'helloWorld'
toSnake('helloWorld') // 'hello_world'
toPascal('hello_world') // 'HelloWorld'
```
### File Operations
```ts
import { readOpenapiAsync, writeInterfaceAsync, createTmpDirAsync } from '@devup-api/utils'
// Read OpenAPI schema
const schema = await readOpenapiAsync('openapi.json')
// Create temp directory
const tempDir = await createTmpDirAsync('my-temp-dir')
// Write interface file
await writeInterfaceAsync('api.d.ts', interfaceContent)
```
## License
Apache 2.0