UNPKG

@shawnvogt/strapi-plugin-google-translate

Version:

Strapi plugin for automated translation of content using Google Cloud Translation

17 lines (13 loc) 492 B
'use strict' /** * Calculate the length of a string in byte when it is encoded using `encodeURI` * @param {string} string String to get the byte length for * @returns The length of the string in bytes when encoded using `encodeURI` */ function stringByteLength(string) { return Buffer.byteLength(string, 'utf8') } function stringByteLengthEncoded(string) { return stringByteLength(encodeURI(string)) } module.exports = { stringByteLength, stringByteLengthEncoded }