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

Function extractProps

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

Source from the content-addressed store, hash-verified

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

Callers 1

createComponentFunction · 0.70

Calls 2

checkPropFunction · 0.70
hyphenateFunction · 0.50

Tested by

no test coverage detected