millisecond 0.1.0

  • README.md
  • Installing
  • Versions
  • 59

Millisecond

Linux Build Pub version Commitizen friendly

Library to easily convert various time formats to milliseconds and milliseconds to human readable format.

Installing via Pub

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

dependencies:
  millisecond: 0.1.0

Usage

import "package:millisecond/millisecond.dart" as ms;


// `String` to `int`
ms.parse("5h"); // => 18000000
ms.parse("20 sec"); // => 20000
ms.parse("1.5 hours"); // => 5400000
ms.parse("day"); // => null
ms.parse("2y"); // => 63115200000


// `num` to `String`
// Short format
ms.format(200); // 200ms
ms.format(1000); // 1s
ms.format(60 * 60 * 1000 * 6); // 6h

// Long format
ms.format(200, long: true); // 200 ms
ms.format(1000, long: true); // 1 second
ms.format(60 * 60 * 1000 * 6, long: true); // 6 hours


// `num` to `String`
// Short format
ms.format(60 * 60 * 1000 * 6); // => "6h"

// Long format
ms.format(1000, long: true); // => "1 second"

Test

pub run test

Contributing

  1. Fork it (https://github.com/SuperPaintman/ms.dart/fork)
  2. Create your feature branch (git checkout -b feature/<feature_name>)
  3. Commit your changes (git commit -am '<type>(<scope>): added some feature')
  4. Push to the branch (git push origin feature/<feature_name>)
  5. Create a new Pull Request

Contributors


API

Docs


Changelog

Changelog


License

MIT

Use this package as a library

1. Depend on it

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


dependencies:
  millisecond: ^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:millisecond/millisecond.dart';
  
Version Uploaded Documentation Archive
0.1.0 Jul 6, 2017 Go to the documentation of millisecond 0.1.0 Download millisecond 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
39
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

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

Maintenance issues and suggestions

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

Add SDK constraint in pubspec.yaml. (-5 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Package is getting outdated. (-26.30 points)

The package was released 65 weeks ago.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use millisecond.dart.

Dependencies

Package Constraint Resolved Available
Dev dependencies
test 0.12.23+1