vue-set-value

Vue.set with dot notation support (`'a.b.c'`) paths.
3,601 2
Install
npm install vue-set-value
Latest Version:1.0.3
Vue:2
License:MIT
Last Updated:Dec 1, 2018
Links: GitHub  ·  npm
Maintainer: yarsky

vue-set-value

Create nested values and any intermediaries on vue reactive objects using dot notation ('a.b.c') paths.

This project is only fork of great package set-value made by Jon Schlinkert

Install

Install with npm:

$ npm install --save vue-set-value

Usage

var vueDeepSet = require('vue-set-value');
vueDeepSet(object, prop, value);

Params

  • object {object}: The object to set value on
  • prop {string}: The property to set. Dot-notation may be used.
  • value {any}: The value to set on object[prop]

Examples

Updates and returns the given object:

vueDeepSet(target, 'a.b.c', 'd');
console.log(target);
//=> { a: { b: { c: 'd' } } }

Escaping

Escaping with backslashes

Prevent set-value from splitting on a dot by prefixing it with backslashes:

console.log(vueDeepSet(target, 'a\\.b.c', 'd'));
//=> { 'a.b': { c: 'd' } }

console.log(vueDeepSet(target, 'a\\.b\\.c', 'd'));
//=> { 'a.b.c': 'd' }

License

Copyright © 2018, Yaroslav Dobzhanskij. Copyright © 2018, Jon Schlinkert. Released under the MIT License.

Related Packages

@websanova/vue-dot

Specialized dot notation get, set deep merge for vue.js objects.

1,337
vue-coerce-props

Coerce props to custom values

704,108 72
vue-set-path

Set Vue reactive properties on a object, using dot notation path syntax

17,730 4
queryzz

queryzz - a lightweight JS library for manipulating URL query parameters. Get, s...

3,375 9
vue-deepset

Deep set Vue.js objects

93,533 91

Version History

Version Released Vue License
1.0.3 ^2.5.16 MIT
1.0.2 ^2.5.16 MIT
1.0.1 ^2.5.16 MIT
1.0.0 ^2.5.16 MIT