0.3.5 โข Published 7 months ago
@a_ng_d/figmug-utils v0.3.5
Figmug Utils
A collection of lightweight, platform-agnostic utility modules designed to accelerate plugin development. These modules provide common functionalities that can be used across any JavaScript/TypeScript project, making them perfect for plugins, extensions, or any web application.
Installation
npm install figmug-utils
# or
yarn add figmug-utilsAvailable Modules
Case Transformer
Convert strings between different case formats:
import { Case } from 'figmug-utils'
const text = new Case('Hello World Example')
text.doSnakeCase() // 'hello_world_example'
text.doCamelCase() // 'helloWorldExample'
text.doPascalCase() // 'HelloWorldExample'
text.doKebabCase() // 'hello-world-example'Feature Status
Manage feature flags and access control:
import { FeatureStatus } from 'figmug-utils'
const feature = new FeatureStatus({
features: features,
featureName: 'PREMIUM_FEATURE',
planStatus: 'UNPAID',
suggestion: 'Upgrade to access this feature',
})
if (feature.isBlocked()) {
console.log(feature.isAvailableAndBlocked()) // 'Upgrade to access this feature'
}Class Names Utility
Clean conditional class name concatenation:
import { doClassnames } from 'figmug-utils'
const classes = doClassnames([
'button',
isActive && 'active',
isPrimary && 'primary',
undefined,
null,
]) // Returns: 'button active primary'Why Figmug Utils?
- ๐ฏ Platform Agnostic: Works anywhere JavaScript runs
- ๐ชถ Lightweight: Each module can be imported independently
- ๐ฆ Zero Dependencies: Pure JavaScript implementations
- ๐ Type-Safe: Written in TypeScript with full type definitions
- ๐งช Well Tested: Comprehensive test coverage
Test Coverage
--------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------|---------|----------|---------|---------|-------------------
All files | 100 | 98.59 | 100 | 100 |
case | 100 | 100 | 100 | 100 |
do-classnames | 100 | 100 | 100 | 100 |
do-map | 100 | 100 | 100 | 100 |
do-scale | 100 | 95.45 | 100 | 100 | 41
feature-status | 100 | 100 | 100 | 100 |Development
# Install dependencies
npm install
# Run tests
npm test
# Build the library
npm run buildContributing
We welcome contributions! Please see our contributing guidelines for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.