From f45d133d3cb54b542b85f386b6c64fea606d67ea Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Mon, 21 Jan 2019 17:20:03 -0800 Subject: [PATCH] remove verifyPayloadSize from util --- components/Editor.js | 16 ++++++++-------- lib/util.js | 7 ------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/components/Editor.js b/components/Editor.js index 3fd9056..cee5c19 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -33,14 +33,7 @@ import { DEFAULT_PRESET_ID } from '../lib/constants' import { serializeState, getQueryStringState } from '../lib/routing' -import { - getSettings, - escapeHtml, - unescapeHtml, - formatCode, - omit, - verifyPayloadSize -} from '../lib/util' +import { getSettings, escapeHtml, unescapeHtml, formatCode, omit } from '../lib/util' import LanguageIcon from './svg/Language' import ThemeIcon from './svg/Theme' @@ -428,6 +421,13 @@ class Editor extends React.Component { } } +const MAX_PAYLOAD_SIZE = 5e6 // bytes +function verifyPayloadSize(str) { + if (typeof str !== 'string') return true + + return new Blob([str]).size < MAX_PAYLOAD_SIZE +} + function isImage(file) { return file.type.split('/')[0] === 'image' } diff --git a/lib/util.js b/lib/util.js index fa9e65b..0e39260 100644 --- a/lib/util.js +++ b/lib/util.js @@ -76,10 +76,3 @@ export const omit = (object, keys) => omitBy(object, (_, k) => keys.indexOf(k) > export const stringifyRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})` export const capitalize = s => s.charAt(0).toUpperCase() + s.slice(1) - -const MAX_PAYLOAD_SIZE = 5e6 -export const verifyPayloadSize = str => { - if (typeof str !== 'string') return true - - return new Blob([str]).size < MAX_PAYLOAD_SIZE // bytes -}