mustache_recase 2.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 67

mustache_recase #

A library for extending the functionality of mustache package with recase

Usage #

import 'package:mustache/mustache.dart';
import 'package:mustache_recase/mustache_recase.dart' as mustache_recase;

void main(){
  Template template = new Template("{{#title_case}} {{hello}} {{/title_case}}");
  Map variables = {"hello": "hello-world"};
  variables.addAll(mustache_recase.cases);
  String output = template.renderString(variables);
  print(output); // Hello World
}

See (or interact with) the example and/or the test of the package if you have doubts

List of usable cases #

  • snake_case
  • dot.case
  • path/case
  • param-case
  • PascalCase
  • Header-Case
  • Title Case
  • camelCase
  • Sentence case
  • CONSTANT_CASE

misc #

This package was made with Generator+ package in an effort to have it tested and, at the same time, extended in it's mustache templates related features. I'm glad it worked as expected 😃

Changelog #

2.0.1 #

  • Removed Generator+ dep

2.0.0 #

  • recase dep. updated to 2.0.0

1.0.3 #

  • Mocosoft free
  • Dart 2 compatibility with <3.0.0 constraint
  • verbose description with >60 chars
  • Example file renamed to example.dart

1.0.2 #

  • Generator+ public scaffolded structure reintroduced
  • Generator+ pubspec.yaml's constraint moved from dev dependencies

1.0.1 #

  • Generator+ public scaffolded structure removed
  • pubspec.yaml constraints updated

1.0.0 #

  • Stable and ready to use release

0.0.1 #

  • Initial version, created by Stagehand

example/main.dart

import "dart:io";

import 'package:mustache/mustache.dart';
import 'package:mustache_recase/mustache_recase.dart' as mustache_recase;

main(List<String> args) {
  stdout.write("Provide a test string: ");
  String testVar = stdin.readLineSync();

  String templateSource = '';
  //@generationAfter("new-case_example_template")
  templateSource +=
      "Dot Case: {{ # dot_case }}{{test_var}} {{ / dot_case }} \n";
  templateSource +=
      "Path Case: {{ # path_case }}{{test_var}} {{ / path_case }} \n";
  templateSource +=
      "Constant Case: {{ # constant_case }}{{test_var}} {{ / constant_case }} \n";
  templateSource +=
      "Header Case: {{ # header_case }}{{test_var}} {{ / header_case }} \n";
  templateSource +=
      "Sentence Case: {{ # sentence_case }}{{test_var}} {{ / sentence_case }} \n";
  templateSource +=
      "Title Case: {{ # title_case }}{{test_var}} {{ / title_case }} \n";
  templateSource +=
      "Param Case: {{ # param_case }}{{test_var}} {{ / param_case }} \n";
  templateSource +=
      "Pascal Case: {{ # pascal_case }}{{test_var}} {{ / pascal_case }} \n";
  templateSource +=
      "Snake Case: {{ # snake_case }}{{test_var}} {{ / snake_case }}\n";
  templateSource +=
      "Camel Case: {{ # camel_case }}{{test_var}} {{ / camel_case }}\n";

  Template template = new Template(templateSource);
  Map variables = {"test_var": testVar};
  variables.addAll(mustache_recase.cases);
  String output = template.renderString(variables);
  print(output);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mustache_recase: ^2.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mustache_recase/mustache_recase.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
87
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

We analyzed this package on Dec 7, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: web, other

Primary library: package:mustache_recase/mustache_recase.dart with components: mirrors.

Health suggestions

Fix lib/src/mustache_recase_base.dart. (-4.89 points)

Analysis of lib/src/mustache_recase_base.dart reported 10 hints, including:

line 22 col 40: Unnecessary new keyword.

line 23 col 40: Unnecessary new keyword.

line 25 col 7: Unnecessary new keyword.

line 26 col 40: Unnecessary new keyword.

line 27 col 40: Unnecessary new keyword.

Maintenance suggestions

Package is getting outdated. (-13.15 points)

The package was last published 59 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
mustache >=1.0.0 <2.0.0 1.1.1
recase ^2.0.0 2.0.1
Dev dependencies
test >=0.12.0 <1.4.0