cheminfo / cheminfo/nmrium

Replace numeral by sprintf-js

Open
#2,552 2 comments 0 reactions 0 assignees View on GitHub
to discuss
Dominant language
TypeScript
Stars
80
Forks
34
Avg merge
2d 9h
Merged PRs (30d)
36

Description

Both libraries are unsupprted anyway. But sprintf-js has more downloads 😀

Why should we replace the library:
1. We can format a number and add units
2. We can format a string and take only part of it

Disadvantage:
- nobody knows the syntax (or nearly)

Examples:

```
var sprintf = require('sprintf-js').sprintf;

console.log(sprintf('%s', 'abcdef')) // abcdef
console.log(sprintf('%.4s', 'abcdef')) // abcd
console.log(sprintf('%d', 123.1234)) // 123
console.log(sprintf('%d MHz', 123.1234)) // 123 MHz
console.log(sprintf('%.2f', 123.1234)) // 123.12
console.log(sprintf('%.2f', 123)) // 123.00
console.log(sprintf('%04d', 123.1234)) // 0123
```

If we replace the library we should think about settings migration.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.