@encodable/format
Advanced tools
Comparing version 0.4.3 to 0.4.4
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.4.4](https://github.com/apache-superset/encodable/compare/@encodable/format@0.4.3...@encodable/format@0.4.4) (2020-08-15) | ||
**Note:** Version bump only for package @encodable/format | ||
## [0.4.3](https://github.com/apache-superset/encodable/compare/@encodable/format@0.4.2...@encodable/format@0.4.3) (2020-08-14) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@encodable/format", | ||
"version": "0.4.3", | ||
"description": "Encodable format", | ||
"version": "0.4.4", | ||
"description": "Utilities for managing time and number formats.", | ||
"sideEffects": false, | ||
@@ -31,3 +31,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@encodable/registry": "^0.5.0", | ||
"@encodable/registry": "^0.5.1", | ||
"@types/d3-format": "^1.3.1", | ||
@@ -40,3 +40,3 @@ "@types/d3-time": "^1.0.10", | ||
}, | ||
"gitHead": "f63359aa7baa94f2ef371bf1030257ca49769bb5" | ||
"gitHead": "42f2c76bc6fdd53e9afece65d299cf2d4f8016c3" | ||
} |
@@ -6,15 +6,38 @@ ## @encodable/format | ||
Description | ||
Utilities for managing time and number formats. | ||
Built on top of D3 formats and support customizing your own formatters. | ||
#### Example usage | ||
### Install | ||
```js | ||
import { xxx } from '@encodable/format'; | ||
```sh | ||
npm install @encodable/format global-box | ||
``` | ||
#### API | ||
### Example usage | ||
`fn(args)` | ||
```ts | ||
import { | ||
getTimeFormat, | ||
formatTime, | ||
getNumberFormat, | ||
formatNumber, | ||
getNumberFormatterRegistry, | ||
} from '@encodable/format'; | ||
- Do something | ||
// Get number format function | ||
const numFormatFn = getNumberFormat('.2f'); | ||
// Get time format function | ||
const timeFormatFn = getTimeFormat('%Y-%m-%d'); | ||
// or just format directly | ||
formatNumber('.2f', 200); // 200.00 | ||
formatTime('%Y-%m-%d', new Date()); // 2020-08-15 | ||
// can customize by adding your own formatters | ||
// or override the d3 ones | ||
getNumberFormatterRegistry().registerValue('my-format', (x) => `haha:${x}`); | ||
formatNumber('my-format', 200); // haha:200 | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87154
43
Updated@encodable/registry@^0.5.1