Socket
Socket
Sign inDemoInstall

location

Package Overview
Dependencies
0
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    location

A Browser-esque location object


Version published
Maintainers
0
Install size
2.76 kB
Created

Readme

Source

location

A mock location object for unit tests and such and to maintain compatibility between Ender.JS and Node.JS

For best results, create a location.config.js in the working directory of your app that returns a location object that should be used.

Current Implementation

var fs = require('fs')
  , location
  , defaultLocation
  ;

defaultLocation = {
  "origin": "http://localhost:3000",
  "pathname": "/",
  "host": "localhost:3000",
  "hostname": "localhost",
  "port": "3000",
  "search": "",
  "hash": "#home",
  "href": "http://localhost:3000/#home",
  "protocol": "http:"
};

try {
  // TODO try all from `__dirname` to `/` before giving up
  location = fs.readFileSync('./location.config.js');
} catch(e) {
  location = defaultLocation;
}

module.exports = location;

TODO

Look for __dirname + "location.config.js" and then look up one directory at each failure before finally giving up and using the default object.

FAQs

Last updated on 26 Jul 2011

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc