Notorious Public Menace

    feathers-utils
    TypeScript icon, indicating that this package has built-in type declarations

    1.10.0 • Public • Published

    feathers-utils

    npm GitHub Workflow Status Code Climate maintainability Code Climate coverage libraries.io npm GitHub license

    Installation

    npm i feathers-utils

    Usage

    Hooks

    • checkMulti: throws if the request is multi data, but the service has allowsMulti(method) returns false
    • createRelated: simply create related items from a hook.
    • removeRelated: simple remove related items from a hook. Basically cascade at feathers level.
    • runPerItem: run a function for every item. Meant for multi:true.
    • setData: map properties from context to data. Something like userId: context.params.user.id

    Mixins

    • mixins/debounceMixin & mixins/DebouncedStore

    Utils

    • addHook: add hooks to specific services
    • filterQuery
    • getItemsIsArray(context): returns { items: any[], isArray: boolean }
    • getPaginate
    • isMulti(context) => Boolean: returns true, if find, create/patch/remove: multi
    • isPaginated
    • markHookForSkip: add hookName to context.params.skipHooks - also see shouldSkip
    • mergeQuery: deeply merges queries
    • mergeArrays: merges arrays with intersection options
    • pushSet: if existing array: push, else set
    • setResultEmpty
    • shouldSkip: checks context.params.skipHooks for 'all' | '${hookName}' | '${type}:${hookName}' - also see markHookForSkip

    Keywords

    none

    Install

    npm i feathers-utils

    DownloadsWeekly Downloads

    534

    Version

    1.10.0

    License

    MIT

    Unpacked Size

    129 kB

    Total Files

    109

    Last publish

    Collaborators

    • fratzinger