UNPKG

@commercelayer/sdk-utils

Version:
47 lines (45 loc) 1.06 kB
'use strict'; // src/helpers/include/base.ts var IncludePath = class { #resources = []; clear() { this.#resources = []; return this; } add(resource) { this.#resources.push(resource); return this; } get() { return this.#resources; } }; var ResourceInclude = class { #includePath; constructor(includePath) { this.#includePath = includePath || new IncludePath(); } include(resource) { return this.#includePath.add(resource); } get() { return this.#includePath.get().join("."); } build() { const newInclude = this.get(); this.#includePath.clear(); return newInclude; } addTo(filter) { const newInclude = this.get(); const currentInclude = filter.include || []; if (newInclude && !currentInclude.includes(newInclude)) { currentInclude.push(newInclude); filter.include = currentInclude; } this.#includePath.clear(); } }; exports.ResourceInclude = ResourceInclude; //# sourceMappingURL=chunk-JHES2HFY.cjs.map //# sourceMappingURL=chunk-JHES2HFY.cjs.map