# elementor/3.8.0-beta1/app/modules/kit-library/assets/js/models/base-model.js

Elementor Website Builder – more than just a page builder, version 3.8.0-beta1. 32 lines.

- Page: https://pluginprobe.com/plugins/elementor/3.8.0-beta1/code/app/modules/kit-library/assets/js/models/base-model.js
- Raw: https://pluginprobe.com/plugins/elementor/3.8.0-beta1/raw/app/modules/kit-library/assets/js/models/base-model.js
- Modified: 2022-09-19T16:26:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/elementor/3.8.0-beta1/code/app/modules/kit-library/assets/js/models/base-model.js#L10-L20`.

```javascript
export default class BaseModel {
	/**
	 * Clone to object to avoid changing the reference.
	 *
	 * @return {BaseModel} cloned model
	 */
	clone() {
		const instance = new this.constructor();

		Object.keys( this ).forEach( ( key ) => {
			instance[ key ] = this[ key ];
		} );

		return instance;
	}

	/**
	 * Using init and not the default constructor because there is a problem to fill the instance
	 * dynamically in the constructor.
	 *
	 * @param {*} data
	 * @return {BaseModel} model
	 */
	init( data = {} ) {
		Object.entries( data ).forEach( ( [ key, value ] ) => {
			this[ key ] = value;
		} );

		return this;
	}
}

```
