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

Function extractProps

static/vuejs/vue.js:3168–3205  ·  view source on GitHub ↗
(data, Ctor, tag)

Source from the content-addressed store, hash-verified

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

Callers 1

createComponentFunction · 0.70

Calls 2

checkPropFunction · 0.70
hyphenateFunction · 0.50

Tested by

no test coverage detected