UNPKG

next-page-budget

Version:

CLI tool to specify and control per page JS bundle limit for Next.js applications

22 lines (17 loc) 432 B
const isObject = (obj) => { return typeof obj === 'object' && obj !== null && !Array.isArray(obj); } const getSizeOfStringInBytes = (string) => { return Buffer.byteLength(string, 'utf8'); } const uniqueArray = (array) => { function onlyUnique(value, index, self) { return self.indexOf(value) === index; } return array.filter(onlyUnique); } module.exports = { isObject, getSizeOfStringInBytes, uniqueArray, }