UNPKG

@pnp/sp

Version:

pnp - provides a fluent api for working with SharePoint REST

35 lines 980 B
import { SPQueryable } from "./spqueryable.js"; export class SPFI { /** * Creates a new instance of the SPFI class * * @param root Establishes a root url/configuration */ constructor(root = "") { this._root = SPQueryable(root); } /** * Applies one or more behaviors which will be inherited by all instances chained from this root * */ using(...behaviors) { this._root.using(...behaviors); return this; } /** * Used by extending classes to create new objects directly from the root * * @param factory The factory for the type of object to create * @returns A configured instance of that object */ create(factory, path) { return factory(this._root, path); } } export function spfi(root = "") { if (typeof root === "object" && !Reflect.has(root, "length")) { root = root._root; } return new SPFI(root); } //# sourceMappingURL=fi.js.map