I am very new to JavaScript and read some questions about the topic but none of them gave me a solution to my problem.
I want to change user data in Active Directory, so I use ldapjs. There is a method to change a property of a user.
client.modify(
user['dn'],
[new ldap.Change({
operation: 'replace',
modification: {
_var_: u['st']
}})]);
When I know the key (_var_)I want to set, this works perfectly. But I got an object that contains any to be changed key-value pairs. Something like u = { sn: 'test', l: 'test', st: 'test'}; Now I want to iterate over all properties of u and modify the related properties of user (in AD). Is there a way to set the _var_ key in modification dynamically to fit the actual key of u (sn, l, st)?
_var_contain in this case?