import snakeCase = require ( "lodash.snakecase" ) ; import { BlockAttributes } from "./types" ; param attributes export const normalizeBlockAttributes = ( attributes ) : BlockAttributes => { if ( typeof attributes !== "object" ) { return { } ; } let changed = false ; const result = { ... attributes } ; for ( const key in attributes ) { if ( Object . prototype . hasOwnProperty . call ( attributes , key ) ) { const normalizedKey = snakeCase ( key ) ; if ( normalizedKey !== key ) { result [ normalizedKey ] = result [ key ] ; delete result [ key ] ; changed = true ; } } } return changed ? result : attributes ; } ;