• Factory function that simplifies the creation of a new model

    Parameters

    Returns ((future) => any)

    Remarks

    This method will map the response object to an IFutureModelOptions instance and construct a new instance of a model using the provided factory. This will provide a shorthand for consumers when creating instances of models and allows for additional operations to be performed as part of the creation process.

    Example

    // create a new (potentially static) instance of the factory that can be used throughout the code.
    const buildFutureModel = buildFuture((FutureModel.Factory));

    // use the builder to create a new instance of the model from an options instance.
    const future: IFutureResponse = someFunctionToGetResponseFromServer();
    const futureModel = buildFutureModel(future);