Commit 122ba198 authored by S Anand's avatar S Anand
Browse files

ENH: FormHandler namespaces. Fixes #28

parent 8258e5ab
Pipeline #46203 passed with stage
in 2 minutes and 2 seconds
......@@ -256,3 +256,21 @@ export function update(args, mode) {
self.search = qparts.join('&')
return self
}
export function namespace(search, name) {
// Return an object with all keys in search that begin with `<name>:` or
// do not have a `:` in them.
// If name is false-y, return search
if (!name)
return search
var result = {}
for (var key in search) {
var parts = key.split(':')
if (parts.length == 1)
result[parts[0]] = search[key]
else if (parts[0] === name)
result[parts[1]] = search[key]
}
return result
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment