With Lodash omit, for example, to remove object properties using this piece of code:
omit
this.current.obj = omit(this.current.obj, ['sellerSupportWeb', 'sellerSupportAgency', 'sellerSupportAgent'])
But this will create another object this.current.obj, but in my case I need to keep the same object
this.current.obj
Do you have an alternative solution? But not an operatordelete
delete
You can use lodash _.unset()to remove a property from an object:
_.unset()
var obj = { a: 1, b: 2, c: 3 }; _.unset(obj, 'a'); console.log(obj);
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script>
. - , , delete ( , , , , ).
, Proxy has, ownKeys, get .. , , . .
Proxy
has
ownKeys
get
. . : , . ( ), delete .
You can set the property undefined, and then when you try to access it, the result will be the same if the property was not.
myObject = { myProp = 'myValue' } myObject.myProp = undefined; console.log(myObject.myProp); console.log(myObject.inexistentProp);
Source: https://habr.com/ru/post/1684460/More articles:How do I split a string into a List of characters in F Sharp - f #how to make git push origin --force; in Visual Studio Team Explorer - gitКак вставить вложенные данные json в таблицу mysql? - jsonVSTS: how to handle FileSystem WebPublishMethod at the Visual Studio build stage with multiple projects - visual-studioWhy can't I get access to renaming the superclass in Kotlin? - javaBootstrap 4 - Elements of a vertical centering list - cssSpecialize a member function of a C ++ class relative to a template class - c ++Delphi return function class object - delphiHow does mocha show the whole object in diff on a statement error? - javascriptDelphi error returning TList - delphiAll Articles