Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@encodable/format

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@encodable/format - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

8

CHANGELOG.md

@@ -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 @@

8

package.json
{
"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
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc