UNPKG

repository-provider

Version:

abstract interface to git repository providers like github, bitbucket and gitlab

60 lines (59 loc) 2.05 kB
/** * Create properties from options and default options. * Already present properties (direct) are skipped. * The attribute list from the class will be applied to the * options and merged with the given set of properties. * ```js * class aClass { * static get attributes() { * return { with_default: { default: 77 }}; * } * } * * definePropertiesFromOptions(new aClass()); * // equivalent to * Object.definedProperties(new aClass(),{ with_default: { value: 77 }}) * ``` * @see Object.definedProperties() * @see Object.getOwnPropertyDescriptor() * @param {Object} object target object * @param {Object} options as passed to object constructor. Used as values for the attributes. * @param {Object} properties object properties * @param {Object} [attributes] attribute meta info */ export function definePropertiesFromOptions(object: any, options?: any, properties?: any, attributes?: any): void; /** * Get default values. * @param {Object} attributes * @param {Object} object * @return {Object} filled with default values */ export function defaultValues(attributes: any, object: any): any; /** * Create json based on present options. * In other words only produce key value pairs if value is defined. * @param {Object} object * @param {Object} initial * @param {Object} attributes to operator on * @return {Object} initial + defined values */ export function optionJSON(object: any, initial?: any, attributes?: any): any; /** * Rename attributes. * Filters out null, undefined and empty strings. * ```js * mapAttributes({a:1},{a:"a'"}) // {"a'": 1} * ``` * @param {Object} object * @param {Object} mapping * @return {Object} keys renamed after mapping */ export function mapAttributes(object: any, mapping: any): any; /** * Same as mapAttributes but with the inverse mapping. * Filters out null, undefined and empty strings * @param {Object} object * @param {Object} [mapping] * @return {Object} keys renamed after mapping */ export function mapAttributesInverse(object: any, mapping?: any): any;