Socket
Socket
Sign inDemoInstall

@ember-data/request-utils

Package Overview
Dependencies
2
Maintainers
0
Versions
124
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ember-data/request-utils


Version published
Weekly downloads
13K
decreased by-41.65%
Maintainers
0
Created
Weekly downloads
 

Readme

Source

EmberData RequestUtils EmberData RequestUtils

Utilities for Requests

This package provides Simple utility function to assist in url building, query params, and other common request operations.

It's built for EmberData but useful more broadly if you're looking for lightweight functions to assist in working with urls and query params.

Installation

Install using your javascript package manager of choice. For instance with pnpm

pnpm add @ember-data/request-utils

Tagged Releases

  • NPM Canary Version
  • NPM Beta Version
  • NPM Stable Version
  • NPM LTS Version
  • NPM LTS 4.12 Version

Utils

As a Library Primitive

These primitives may be used directly or composed by request builders to provide a consistent interface for building requests.

For instance:

import { buildBaseURL, buildQueryParams } from '@ember-data/request-utils';

const baseURL = buildBaseURL({
  host: 'https://api.example.com',
  namespace: 'api/v1',
  resourcePath: 'emberDevelopers',
  op: 'query',
  identifier: { type: 'ember-developer' }
});
const url = `${baseURL}?${buildQueryParams({ name: 'Chris', include:['pets'] })}`;
// => 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris'

This is useful, but not as useful as the REST request builder for query which is sugar over this (and more!):

import { query } from '@ember-data/rest/request';

const options = query('ember-developer', { name: 'Chris', include:['pets'] });
// => { url: 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris' }
// Note: options will also include other request options like headers, method, etc.

Keywords

FAQs

Last updated on 21 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc