0.3.5 โ€ข Published 7 months ago

@a_ng_d/figmug-utils v0.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

GitHub package.json version GitHub last commit GitHub

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-utils

Available 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 build

Contributing

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.

0.3.5

7 months ago

0.3.4

7 months ago

0.3.3

7 months ago

0.3.2

7 months ago

0.3.1

7 months ago

0.3.0

7 months ago

0.2.2

10 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.7

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.1

1 year ago