unorm_dart 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 79

unorm_dart

Unicode 8.0 Normalization - NFC, NFD, NFKC, NFKD

Dart2 port of unorm

Functions

This module exports four functions: nfc, nfd, nfkc, and nfkd; one for each Unicode normalization. In the browser the functions are exported in the unorm global. In CommonJS environments you just require the module. Functions:

  • unorm.nfd(str) – Canonical Decomposition
  • unorm.nfc(str) – Canonical Decomposition, followed by Canonical Composition
  • unorm.nfkd(str) – Compatibility Decomposition
  • unorm.nfkc(str) – Compatibility Decomposition, followed by Canonical Composition

Usage

A simple usage example:

import "package:unorm_dart/unorm_dart.dart" as unorm;

void main() {
  var text = "The \u212B symbol invented by A. J. \u00C5ngstr\u00F6m " +
      "(1814, L\u00F6gd\u00F6, \u2013 1874) denotes the length " +
      "10\u207B\u00B9\u2070 m.";

  var combining = RegExp(r"[\u0300-\u036F]/g");

  print("Regular:  ${text}");
  print("NFC:      ${unorm.nfc(text)}");
  print("NFKC:     ${unorm.nfkc(text)}");
  print("NFKD: *   ${unorm.nfkd(text).replaceAll(combining, "")}");
  print(" * = Combining characters removed from decomposed form.");
}

Generating Unicode data

see yshrsmz/unorm-dart-data-generator.

Features and bugs

Please file feature requests and bugs at the [issue tracker][https://github.com/yshrsmz/unorm-dart].

0.1.0

  • Initial version

example/unorm_dart_example.dart

import "package:unorm_dart/unorm_dart.dart" as unorm;

void main() {
  print(unorm.nfkd("㍍ガバヴァぱばぐゞちぢ十人十色"));

  var text = "The \u212B symbol invented by A. J. \u00C5ngstr\u00F6m " +
      "(1814, L\u00F6gd\u00F6, \u2013 1874) denotes the length " +
      "10\u207B\u00B9\u2070 m.";

  var combining = RegExp(r"[\u0300-\u036F]/g");

  print("Regular:  ${text}");
  print("NFC:      ${unorm.nfc(text)}");
  print("NFKC:     ${unorm.nfkc(text)}");
  print("NFKD: *   ${unorm.nfkd(text).replaceAll(combining, "")}");
  print(" * = Combining characters removed from decomposed form.");
}

Use this package as a library

1. Depend on it

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


dependencies:
  unorm_dart: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:unorm_dart/unorm_dart.dart';
  
Version Uploaded Documentation Archive
0.1.0 Aug 19, 2018 Go to the documentation of unorm_dart 0.1.0 Download unorm_dart 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
79
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:unorm_dart/unorm_dart.dart.

Health suggestions

Format lib/src/unormdata.dart.

Run dartfmt to format lib/src/unormdata.dart.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
Dev dependencies
test ^1.0.0