Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-deep-set

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-deep-set

Deeply set values on an Ember Object or POJO

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

ember-deep-set Download count all time Build Status npm version

ember-deep-set is a simple utility function to deeply set a value on an Ember Object or POJO. Note that this mutates the object.

To install:

ember install ember-deep-set

Why this addon exists

Ember.set will throw an error if you try to set a value on a non-existent object. For example:

Ember.set({}, 'foo.bar.baz', 123); // Property set failed: object in path "foo.bar" could not be found or was destroyed.

With ember-deep-set, you can safely and deeply set values on POJOs as well as Ember.Objects without having to first create the empty intermediate objects.

Usage

import Ember from 'ember';
import deepSet from 'ember-deep-set';

const { get } = Ember;

let company = {};
deepSet(company, 'region.department.director.name', 'Jim Bob');
deepSet(company, 'region.department.name', 'Accounting');
deepSet(company, 'region.name', 'North America');

get(company, 'region.department.name'); // "Accounting"
get(company, 'region.department.director'); // { name: "Jim Bob" }

API

deepSet is designed to be a drop-in replacement to Ember.set:

deepSet( object, key, value )

Parameters:
  • object: {Ember.Object|Object} The object to set values on
  • key: {String} The key to set
  • value: {Any} Value to set
Returns:
  • value: {Any} Value that was passed in

Installation

  • git clone <repository-url> this repository
  • cd ember-deep-set
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

Keywords

FAQs

Package last updated on 05 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc