Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Bug report
description: Report a bug, regression, or unexpected behavior in stringr.
title: "[Bug]: "
labels:
- bug
body:
- type: textarea
id: summary
attributes:
label: Summary
description: What went wrong?
placeholder: A short description of the bug.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Share the smallest example that reproduces the issue.
placeholder: |
import 'package:stringr/stringr.dart';

void main() {
print('example'.someMethod());
}
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: What did you expect to happen?
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual behavior
description: What happened instead?
validations:
required: true
- type: input
id: version
attributes:
label: stringr version
placeholder: 1.2.1
validations:
required: true
- type: input
id: dart_version
attributes:
label: Dart version
placeholder: Dart 3.x
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: Add screenshots, environment notes, or related details if helpful.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Security policy
url: https://github.com/Chinmay-KB/stringr/blob/master/SECURITY.md
about: Please review the security policy before reporting a sensitive issue.
- name: Contribution guide
url: https://github.com/Chinmay-KB/stringr/blob/master/CONTRIBUTING.md
about: Read the contribution guide before opening a pull request.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/docs_improvement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Documentation improvement
description: Report missing, unclear, or incorrect documentation.
title: "[Docs]: "
labels:
- documentation
body:
- type: textarea
id: location
attributes:
label: Location
description: Which file, page, or section needs improvement?
placeholder: README.md, CONTRIBUTING.md, API docs, examples, etc.
validations:
required: true
- type: textarea
id: issue
attributes:
label: What is unclear or missing?
validations:
required: true
- type: textarea
id: suggestion
attributes:
label: Suggested improvement
description: Optional, but helpful if you already know what would make the docs clearer.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Feature request
description: Propose a new API, enhancement, or behavior change.
title: "[Feature]: "
labels:
- enhancement
body:
- type: textarea
id: problem
attributes:
label: Problem or use case
description: What are you trying to do that stringr does not support well today?
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposed solution
description: Describe the API or behavior you would like to see.
validations:
required: true
- type: textarea
id: examples
attributes:
label: Examples
description: Share example inputs and expected outputs.
placeholder: |
Input: ...
Output: ...
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
description: Have you tried existing methods or workarounds?
52 changes: 52 additions & 0 deletions .github/ISSUE_TEMPLATE/unicode_edge_case.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Unicode edge case
description: Report behavior involving graphemes, combining marks, emoji, casing, transliteration, or non-Latin scripts.
title: "[Unicode]: "
labels:
- bug
- unicode
body:
- type: textarea
id: input
attributes:
label: Input string
description: Provide the exact input string. Include escaped form too if helpful.
placeholder: "👨‍👩‍👧‍👦 family / café / XMLHttpRequest / полет птицы"
validations:
required: true
- type: input
id: method
attributes:
label: Method or API used
placeholder: slugify(), words(), reverse(), camelCase()
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Share a small runnable example.
placeholder: |
import 'package:stringr/stringr.dart';

void main() {
print('café'.countGrapheme());
}
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected output
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual output
validations:
required: true
- type: textarea
id: notes
attributes:
label: Notes
description: Mention script, locale expectations, normalization details, or comparisons with other libraries if relevant.
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Summary

Describe the change and why it is needed.

## Changes

-

## Testing

- [ ] `dart format .`
- [ ] `dart analyze`
- [ ] `dart test`

## Notes

Add any compatibility notes, Unicode edge cases, follow-ups, or reviewer context here.
68 changes: 68 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# AGENTS.md

## Project Overview

Stringr is a comprehensive string manipulation library for Dart/Flutter inspired by VocaJS. It provides powerful string operations that work with Latin, non-Latin, and grapheme cluster strings using complex regular expressions rather than simple whitespace splitting.

**Current Status**: Updated to Dart 3.0+ with modern SDK constraints and comprehensive linting rules.

## Development Commands

### Testing

- `dart test` - Run all tests
- `dart run test_coverage` - Run tests with coverage (used in CI)
- `dart test test/specific_test.dart` - Run specific test file

### Dependencies

- `dart pub get` - Install dependencies
- `dart pub upgrade` - Upgrade dependencies

### Analysis

- `dart analyze` - Static analysis with comprehensive modern Dart linting rules

## Architecture Overview

The library follows a **modular extension-based architecture** with functionality organized into domain-specific modules:

### Core Modules

- **`lib/src/case/`** - Case transformations (camelCase, kebabCase, snakeCase, titleCase)
- **`lib/src/chop/`** - String truncation operations (truncate, slice, prune, first, last)
- **`lib/src/count/`** - Counting operations (characters, graphemes, occurrences, words)
- **`lib/src/escape/`** - String escaping/unescaping (HTML, RegExp)
- **`lib/src/manipulate/`** - String manipulation (insert, reverse, slugify, translate, splice)
- **`lib/src/split/`** - String splitting operations (words, chars, codePoints, graphemes)

### Utility Infrastructure

- **`lib/src/util/object/`** - Generic utility extensions (ExtendedIterable)
- **`lib/src/util/regex/`** - Pre-compiled regex patterns and constants for Unicode handling
- **`lib/src/util/strings/`** - String utility functions, diacritics mapping, and surrogate pair handling

### Key Patterns

- Each module implements a Dart extension on `String` class
- Heavy use of pre-compiled regex patterns for Unicode-aware text processing
- Consistent method signatures with optional parameters and sensible defaults
- Support for complex Unicode scenarios including surrogate pairs and grapheme clusters

## Dependencies

- **`characters`** ^1.3.0 - Used for grapheme cluster support and Unicode handling (Flutter-compatible version)
- **`test`** ^1.26.3 - Modern testing framework (dev dependency)

## Important Notes

- Project uses dependency overrides for `file` and `watcher` packages to ensure Dart 3.0+ compatibility
- The codebase has comprehensive linting rules enforced through `analysis_options.yaml`
- All tests pass on Dart 3.0+ but there are linting warnings that can be addressed incrementally

## CI/CD

- GitHub Actions workflow runs on push/PR to master branch
- Uses latest stable Dart container (`dart:stable`)
- Runs tests with coverage and uploads to Codecov
- Coverage reports stored in `coverage/lcov.info`
47 changes: 47 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributor Covenant Code of Conduct

## Our pledge

We as contributors and maintainers pledge to make participation in the `stringr` community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our standards

Examples of behavior that contributes to a positive environment include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Taking responsibility, apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best for the community as a whole

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement responsibilities

Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior they deem inappropriate, threatening, offensive, or harmful.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all project spaces, and also applies when an individual is officially representing the project in public spaces. Examples of representing the project include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers through GitHub issues or discussions when appropriate. For security-sensitive concerns, use the process described in `SECURITY.md`.

All complaints will be reviewed and investigated promptly and fairly.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.

For answers to common questions about this code of conduct, see the [FAQ](https://www.contributor-covenant.org/faq).
Loading
Loading