WireBootstrap
HomeDocsBuySupport
  • Introduction
  • Overview
  • Getting Started
  • Installation
  • Connecting to Data
    • Data Connectors
      • SQL Data
      • Custom Web Services
      • Local Data
      • Other Sources
    • Data Sources
    • Discovery
    • Building a Data Connector
  • Working With Queries
    • Select Queries
      • Query Extensions
    • Stored Procedures
    • Custom Web Services
    • Executing Queries
    • ORM
  • Writing Data
  • Updates
  • Deletes
  • Working with DataTables
    • Introduction
    • Filter and Sort
    • Select and Calculate
    • Joins
    • Rows
    • Columns
  • Working with DataSets
  • Introduction
  • Executing Queries
  • Transforms
  • Writing Data
  • Data Events
  • Working with Components
    • Introduction
    • Encapsulation
    • Configuration
      • Data
      • Events
      • Observables
      • Validation
      • Display
      • Vendor
      • Custom
    • Component
    • Web Frameworks
    • Building a Component
      • Hello World
      • Data Events
      • DataSets
  • Working With Data Events
    • Introduction
    • Event Basics
    • Event Data
    • Event Actions
  • Working with Themes
    • Introduction
    • Sample Data
    • Libraries
    • Pages
    • Building a Theme Project
  • Utilities
    • Formatting
    • Expressions
    • Collections
    • Spinners
    • Copy and Merge
    • Validation
    • Loading Assets
    • Service Calls
    • Download Files
    • Browser Location
    • Types
    • Promise
  • Reference
    • wire
      • wire.Collection
      • wire.download
      • wire.validate
    • wire.data
      • wire.data.DataEvent
      • wire.data.DataModel
      • wire.data.DataPromise
      • wire.data.DataSet
      • wire.data.DataSource
      • wire.data.DataTable
        • Columns
        • Rows
      • wire.data.StoredProcedure
      • wire.data.TableQuery
    • wire.ui
      • wire.ui.Component
      • wire.ui.validate
Powered by GitBook
On this page
  • Copy
  • Merge

Was this helpful?

  1. Utilities

Copy and Merge

Copy

Use the wire.copy function to make a deep copy of an object or Array.

let data = { product: "SKU001", month: "May", sales: 300 }

const dataCopy = wire.copy(data);

Merge

Use the wire.merge function to merge the values of one object into another. This function take two parameters. The first is the target and the second is the source. All properties and their values on the source object will be copied into the target object. If a target property already exists, it will be overwritten by the same on the source. If not, it will be left alone.

In the example below, the target variable values of product and sales will be replaced with those from the source variable but will leave the month attribute alone.

let source = { product: "SKU001", month: "May", sales: 300 }
let target = { product: "SKU431", sales: 500 }

wire.merge(target, source);

// target = { product: "SKU001", month: "May", sales: 300 }
PreviousSpinnersNextValidation

Last updated 4 years ago

Was this helpful?