Options
All
  • Public
  • Public/Protected
  • All
Menu

Enumeration ArrayActions

The actions to take on Settings#update calls.

memberof

Settings

Index

Enumeration members

Enumeration members

Add

Add: = "add"

Override the insert/remove behaviour by pushing new keys to the array to the end or to the specified position.

example

// Push to the end:

settings.get('words'); // -> ['foo', 'bar']

await settings.update('words', ['hello', 'world'], { arrayAction: 'add' }); settings.get('words'); // -> ['foo', 'bar', 'hello', 'world']

example

// Push to a position:

settings.get('words'); // -> ['foo', 'bar']

await settings.update('words', ['hello', 'world'], { arrayAction: 'add', arrayPosition: 1 }); settings.get('words'); // -> ['foo', 'hello', 'world', 'bar']

Auto

Auto: = "auto"

Set insert/remove behaviour, this is the value set by default.

example

settings.get('words'); // -> ['foo', 'bar']

await settings.update('words', ['foo', 'hello']); settings.get('words'); // -> ['bar', 'hello']

Overwrite

Overwrite: = "overwrite"

Overwrite the array with newly set values. The arrayIndex option is ignored when specifying overwrite.

example

settings.get('words'); // -> ['foo', 'bar']

await settings.update('words', ['hello', 'world'], { arrayAction: 'overwrite' }); settings.get('words'); // -> ['hello', 'world']

Remove

Remove: = "remove"

Override the insert/remove behaviour by removing keys to the array to the end or to the specified position.

throws

Throws an error when a value does not exist.

example

// Remove:

settings.get('words'); // -> ['foo', 'bar']

await settings.update('words', ['foo'], { arrayAction: 'remove' }); settings.get('words'); // -> ['bar']

example

// Remove from position:

settings.get('words'); // -> ['foo', 'hello', 'world', 'bar']

await settings.update('words', [null, null], { arrayAction: 'remove', arrayPosition: 1 }); settings.get('words'); // -> ['foo', 'bar']

Generated using TypeDoc