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

@timberio/tools

Package Overview
Dependencies
Maintainers
5
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@timberio/tools - npm Package Compare versions

Comparing version 0.21.0 to 0.22.0

2

LICENSE.md
# License
Copyright (c) 2018, Timber Technologies, Inc.
Copyright (c) 2018. Timber Technologies, Inc.

@@ -5,0 +5,0 @@ Permission to use, copy, modify, and/or distribute this software for any purpose

{
"name": "@timberio/tools",
"version": "0.21.0",
"version": "0.22.0",
"description": "Javascript logging tools",

@@ -36,6 +36,6 @@ "main": "dist/cjs/index.js",

},
"gitHead": "ad47bc5850606d875f014d39f5a81daf87810729",
"gitHead": "40597144b884fdb8481049eac289b7ff9015a671",
"dependencies": {
"@timberio/types": "^0.21.0"
"@timberio/types": "^0.22.0"
}
}

@@ -1,5 +0,11 @@

# 🌲 Timber - Javascript tools
# 🌲 Timber - JS lib tools
## 👷‍️ WIP - Don't use yet! Use [this Timber JS lib](https://github.com/timberio/timber-node) for now
![Beta: Ready for testing](https://img.shields.io/badge/early_release-beta-green.svg)
![Speed: Blazing](https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg)
[![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md)
**New to Timber?** [Here's a low-down on logging in Javascript.](https://github.com/timberio/timber-js)
## `@timberio/tools`
This library provides helper tools used by the [Javascript logger](https://github.com/timberio/timber-js).

@@ -13,2 +19,4 @@

Used to store `.log()` Promises that are being batched/throttled.
**Usage example**

@@ -80,2 +88,27 @@

### `makeBatch(size: number, flushTimeout: number)`
Creates a higher-order batch function aggregates Timber logs and resolves when either `size` # of logs have been collected, or when `flushTimeout` (in ms) has elapsed -- whichever occurs first.
This is used alongside the throttler to provide an array of [`ITimberLog`](https://github.com/timberio/timber-js/tree/master/packages/types#itimberlog) to the function set in the `.setSync()` method, to be synced with [Timber.io](https://timber.io)
Used internally by the [`@timberio/core Base class`](https://github.com/timberio/timber-js/blob/master/packages/core/src/base.ts) to implicitly batch logs:
```typescript
// Create a throttler, for sync operations
const throttle = makeThrottle(this._options.syncMax);
// Sync after throttling
const throttler = throttle((logs: any) => {
return this._sync!(logs);
});
// Create a batcher, for aggregating logs by buffer size/interval
const batcher = makeBatch(this._options.batchSize, this._options.batchInterval);
this._batch = batcher((logs: any) => {
return throttler(logs);
});
```
### `base64Encode(str: string): string`

@@ -96,1 +129,5 @@

```
### LICENSE
[ISC](LICENSE.md)
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