MCPcopy Create free account
hub / github.com/TruthHun/BookStack / extractProps

Function extractProps

static/vuejs/vue.runtime.common.js:3164–3201  ·  view source on GitHub ↗
(data, Ctor, tag)

Source from the content-addressed store, hash-verified

3162}
3163
3164function extractProps (data, Ctor, tag) {
3165 // we are only extracting raw values here.
3166 // validation and default values are handled in the child
3167 // component itself.
3168 var propOptions = Ctor.options.props;
3169 if (!propOptions) {
3170 return
3171 }
3172 var res = {};
3173 var attrs = data.attrs;
3174 var props = data.props;
3175 var domProps = data.domProps;
3176 if (attrs || props || domProps) {
3177 for (var key in propOptions) {
3178 var altKey = hyphenate(key);
3179 if (process.env.NODE_ENV !== 'production') {
3180 var keyInLowerCase = key.toLowerCase();
3181 if (
3182 key !== keyInLowerCase &&
3183 attrs && attrs.hasOwnProperty(keyInLowerCase)
3184 ) {
3185 tip(
3186 "Prop \"" + keyInLowerCase + "\" is passed to component " +
3187 (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
3188 " \"" + key + "\". " +
3189 "Note that HTML attributes are case-insensitive and camelCased " +
3190 "props need to use their kebab-case equivalents when using in-DOM " +
3191 "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
3192 );
3193 }
3194 }
3195 checkProp(res, props, key, altKey, true) ||
3196 checkProp(res, attrs, key, altKey) ||
3197 checkProp(res, domProps, key, altKey);
3198 }
3199 }
3200 return res
3201}
3202
3203function checkProp (
3204 res,

Callers 1

createComponentFunction · 0.70

Calls 2

checkPropFunction · 0.70
hyphenateFunction · 0.50

Tested by

no test coverage detected