Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function decorator($target, $prop) {
if (arguments.length > 1) {
// Non invocation:
// - @children
// Invocation with or w/o opts:
// - @children()
// - @children({...opts})
config.property = $prop;
}
Metadata.define(Children.name, ChildrenDefinition.create($prop, config), $target.constructor, $prop);
Protocol.annotation.appendTo($target.constructor, Children.keyFrom($prop));
}
if (arguments.length > 1) {
function decorator($target: {}, $prop: symbol | string): void {
if (arguments.length > 1) {
// Non invocation:
// - @children
// Invocation with or w/o opts:
// - @children()
// - @children({...opts})
config.property = $prop as string;
}
Metadata.define(Children.name, ChildrenDefinition.create($prop as string, config), $target.constructor, $prop);
Protocol.annotation.appendTo($target.constructor as Constructable, Children.keyFrom($prop as string));
}
function decorator($target, $prop) {
if (arguments.length > 1) {
// Non invocation:
// - @bindable
// Invocation with or w/o opts:
// - @bindable()
// - @bindable({...opts})
config.property = $prop;
}
Metadata.define(Bindable.name, BindableDefinition.create($prop, config), $target.constructor, $prop);
Protocol.annotation.appendTo($target.constructor, Bindable.keyFrom($prop));
}
if (arguments.length > 1) {
it('returns correct keys in definition order when metadata exists and redefined and without key', function () {
const obj = {};
Metadata.define('key1', 'value', obj, void 0);
Metadata.define('key0', 'value', obj, void 0);
Metadata.define('key1', 'value', obj, void 0);
const actual = Metadata.getOwnKeys(obj, void 0);
assert.deepStrictEqual(actual, ['key1', 'key0']);
});
define(nameOrDef, Type) {
const definition = CustomElementDefinition.create(nameOrDef, Type);
Metadata.define(CustomElement.name, definition, definition.Type);
Metadata.define(CustomElement.name, definition, definition);
Protocol.resource.appendTo(definition.Type, CustomElement.name);
return definition.Type;
},
getDefinition(Type) {
define(nameOrDef, Type) {
const definition = CustomElementDefinition.create(nameOrDef, Type);
Metadata.define(CustomElement.name, definition, definition.Type);
Metadata.define(CustomElement.name, definition, definition);
Protocol.resource.appendTo(definition.Type, CustomElement.name);
return definition.Type;
},
getDefinition(Type) {
define(nameOrDef, Type) {
const definition = BindingCommandDefinition.create(nameOrDef, Type);
Metadata.define(BindingCommand.name, definition, definition.Type);
Metadata.define(BindingCommand.name, definition, definition);
Protocol.resource.appendTo(Type, BindingCommand.name);
return definition.Type;
},
getDefinition(Type) {
return function (target) {
const key = Protocol.annotation.keyFor('aliases');
const existing = Metadata.getOwn(key, target);
if (existing === void 0) {
Metadata.define(key, aliases, target);
}
else {
existing.push(...aliases);
}
};
}
add(Type, partialDefinition) {
const definition = CustomElementDefinition.create(partialDefinition);
let views = Metadata.getOwn(Views.name, Type);
if (views === void 0) {
Metadata.define(Views.name, views = [definition], Type);
}
else {
views.push(definition);
}
return views;
},
};
define(nameOrDef, Type) {
const definition = BindingCommandDefinition.create(nameOrDef, Type);
Metadata.define(BindingCommand.name, definition, definition.Type);
Metadata.define(BindingCommand.name, definition, definition);
Protocol.resource.appendTo(Type, BindingCommand.name);
return definition.Type;
},
getDefinition(Type) {