this.scales = {};
this.controllers = {};
}
+
/**
- * @param {string} scope
- * @param {*} values
+ * @param {string|object} scope
+ * @param {object} [values]
*/
set(scope, values) {
- return merge(getScope(this, scope), values);
+ if (typeof scope === 'string') {
+ return merge(getScope(this, scope), values);
+ }
+ return merge(getScope(this, ''), scope);
}
+ /**
+ * @param {string} scope
+ */
get(scope) {
return getScope(this, scope);
}
};
}
+export type AnyObject = Record<string, unknown>;
export interface Defaults extends CoreChartOptions, ElementChartOptions {
controllers: {
[key in ChartType]: DeepPartial<
plugins: PluginOptions;
- set(scope: string, values: any): any;
- get(scope: string): any;
+ set(values: AnyObject): AnyObject;
+ set(scope: string, values: AnyObject): AnyObject;
+ get(scope: string): AnyObject;
/**
* Routes the named defaults to fallback to another scope/name.