From 229028821c8bbf68ec82f7f289d390237050f07c Mon Sep 17 00:00:00 2001 From: cha0s Date: Mon, 4 Apr 2022 10:13:09 -0500 Subject: [PATCH] refactor: 'flate --- packages/core/src/flate.js | 11 +++++++++++ packages/core/src/index.js | 8 ++------ packages/topdown/src/resources/tiles.js | 19 ++----------------- 3 files changed, 15 insertions(+), 23 deletions(-) create mode 100644 packages/core/src/flate.js diff --git a/packages/core/src/flate.js b/packages/core/src/flate.js new file mode 100644 index 0000000..9ff314a --- /dev/null +++ b/packages/core/src/flate.js @@ -0,0 +1,11 @@ +import {deflateSync, inflateSync} from 'zlib'; + +export function inflate(buffer) { + return inflateSync(buffer); +} + +export function deflate(buffer) { + return deflateSync(buffer, { + level: 9, + }); +} diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 69cca84..e89e81a 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -1,15 +1,11 @@ export { default as fastApply, } from './fast-apply'; +export * from './flate'; export { default as mapValuesAsync, } from './map-values-async'; -export { - mergeDiff, - mergeDiffArray, - mergeDiffObject, - mergeDiffPrimitive, -} from './merge-diff'; +export * from './merge-diff'; export { default as Property, } from './property'; diff --git a/packages/topdown/src/resources/tiles.js b/packages/topdown/src/resources/tiles.js index 678e1c9..aeabbfa 100644 --- a/packages/topdown/src/resources/tiles.js +++ b/packages/topdown/src/resources/tiles.js @@ -1,3 +1,4 @@ +import {deflate, inflate} from '@avocado/core'; import {Atlas} from '@avocado/graphics'; import { floodwalk2D, @@ -7,23 +8,7 @@ import { } from '@avocado/math'; import {JsonResource} from '@avocado/resource'; import {Synchronized} from '@avocado/s13n'; -import { - compose, - // deflate, - EventEmitter, - // inflate, -} from '@flecks/core'; -import {deflateSync, inflateSync} from 'zlib'; - -export function inflate(buffer) { - return inflateSync(buffer); -} - -export function deflate(buffer) { - return deflateSync(buffer, { - level: 9, - }); -} +import {compose, EventEmitter} from '@flecks/core'; // TODO: rows, with nulls