You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
616 B
17 lines
616 B
"use strict"; |
|
|
|
var callable = require("es5-ext/object/valid-callable"); |
|
|
|
module.exports = function (userNormalizer) { |
|
var normalizer; |
|
if (typeof userNormalizer === "function") return { set: userNormalizer, get: userNormalizer }; |
|
normalizer = { get: callable(userNormalizer.get) }; |
|
if (userNormalizer.set !== undefined) { |
|
normalizer.set = callable(userNormalizer.set); |
|
if (userNormalizer.delete) normalizer.delete = callable(userNormalizer.delete); |
|
if (userNormalizer.clear) normalizer.clear = callable(userNormalizer.clear); |
|
return normalizer; |
|
} |
|
normalizer.set = normalizer.get; |
|
return normalizer; |
|
};
|
|
|