New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@churchcenter/url

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@churchcenter/url

A dumb url origin generator in JS

  • 1.0.0-alpha.1
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

@churchcenter/url

A dumb url origin generator in JS.

Builds environment-considered url origins in JS-land, for Church Center subdomains.

Examples

churchcenterurl("development")("carlsbad");
// => "http://carlsbad.churchcenter.test"

churchcenterurl("staging")("carlsbad");
// => "https://carlbad.churchcenteronline.com"

churchcenterurl("production")("carlsbad");
// => "https://carlsbad.staging.churchcenteronline.com"

Arguments are curried. You can make a generic env-considered function.

const envURL = churchcenterurl(window.railsEnv);

envURL("api");

In Church Center Apps

Church center apps expose the Rails env as the JS global railsEnv. Use like so.

churchcenterurl(railsEnv)("api");

Fetching example

fetch(`${churchcenterurl(env)("api")}/people/v2/me`, {
  credentials: "include"
})
  .then(res => res.json())
  .then(json => json.data)
  .then(({ id, attributes }) =>
    this.setState({
      currentUser: {
        id,
        ...attributes
      }
    })
  )
  .catch(err => console.log(err));

Installation

Script tag on Rails

<script type="javascript" src="https://unpkg.com/@churchcenter/url"></script>
<!-- exposed as global `churchcenterurl` -->

Webpacker on Rails

yarn add @churchcenter/url
/* global railsEnv */
import pcurl from "@churchcenter/url";

pcurl(railsEnv)("api");

FAQs

Package last updated on 06 Feb 2018

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc