export { klona as clone } from 'klona/json' ; export { diff , apply } from './diff' ; export const UNDEFINED = '__UNDEFINED___' ; export function stringify ( data ) { return JSON . stringify ( data , ( key , value ) => value === undefined ? UNDEFINED : value ) ; } export function parse ( json ) { return JSON . parse ( json , ( key , value ) => value === UNDEFINED ? undefined : value ) ; } export function randId ( ) { return Math . random ( ) . toString ( 36 ) . replace ( /[^a-z]+/g , '' ) . substr ( 2 , 10 ) ; } export function isObject ( obj ) { return typeof obj === 'object' && obj !== null ; } export function reactiveSet ( target , value ) { const originalKeys = new Set ( Object . keys ( target ) ) ; Object . keys ( value ) . forEach ( i => originalKeys . delete ( i ) ) ; Object . assign ( target , value ) ; for ( const key of originalKeys ) delete target [ key ] ; } export function define ( target , key , value ) { Object . defineProperty ( target , key , { value , writable : true , enumerable : false , } ) ; }