Javascript: Given a tag as a string, how to assign it?

Applescript can also map curried functions, but it gets a bit out of breath:

-- tagAdded :: String -> DT Record -> DT Record
on tagAdded(strTag, rec)
    using terms from application "DEVONthink Pro"
        set tags of rec to ((tags of rec) & strTag)
        return rec
    end using terms from
end tagAdded

-- TEST ------------------------------------------------------------
on run
    tell application "DEVONthink Pro" to ¬
        set lstSeln to selection
    
    set strTag to "extraTag"
    
    map(curry(tagAdded)'s |λ|(strTag), lstSeln)
end run

-- GENERIC FUNCTIONS -----------------------------------------
-- curry :: (Script|Handler) -> Script
on curry(f)
    script
        on |λ|(a)
            script
                on |λ|(b)
                    |λ|(a, b) of mReturn(f)
                end |λ|
            end script
        end |λ|
    end script
end curry

-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
    tell mReturn(f)
        set lng to length of xs
        set lst to {}
        repeat with i from 1 to lng
            set end of lst to |λ|(item i of xs, i, xs)
        end repeat
        return lst
    end tell
end map

-- Lift 2nd class handler function into 1st class script wrapper 
-- mReturn :: Handler -> Script
on mReturn(f)
    if class of f is script then
        f
    else
        script
            property |λ| : f
        end script
    end if
end mReturn

Alternatively, assuming the same generic functions:

-- TEST ------------------------------------------------------------
on run
	tell application "DEVONthink Pro"
		set lstSeln to selection
		
		-- tagAdded :: String -> DT Record -> DT Record
		script tagAdded
			on |λ|(strTag, rec)
				set tags of rec to ((tags of rec) & strTag)
				rec
			end |λ|
		end script
	end tell
	
	set addExtra to curry(tagAdded)'s |λ|("extraTag")
	
	map(addExtra, lstSeln)
end run