remove verifyPayloadSize from util

main
Mike Fix 6 years ago committed by Michael Fix
parent dbde17a65f
commit f45d133d3c

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

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

Loading…
Cancel
Save