Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

keen-core

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keen-core - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

7

CHANGELOG.md

@@ -9,2 +9,9 @@ <!--

<a name="0.0.2"></a>
# 0.0.2 RequireJS fix
**FIXED:**
* Fixed RequireJS module definition name typo (#2)
<a name="0.0.1"></a>

@@ -11,0 +18,0 @@ # 0.0.1 Hello, world!

5

CONTRIBUTING.md

@@ -13,9 +13,6 @@ # We <3 Contributions!

$ npm install
# Build project with gulp
# npm install -g gulp
$ gulp
# Build and launch to view test results
$ gulp with-tests
$ gulp
$ open http://localhost:9003

@@ -22,0 +19,0 @@ ```

2

gulpfile.js

@@ -70,3 +70,3 @@ var gulp = require('gulp'),

'gulpfile.js',
'test/**/*.js'
'test/index.js'
], ['build', 'lint']);

@@ -73,0 +73,0 @@ });

@@ -70,5 +70,6 @@ var each = require('./utils/each'),

// IE<10 request shim
if ('undefined' !== typeof document && document.all) {
config.protocol = (document.location.protocol !== 'https:') ? 'http' : 'https';
if (typeof window !== 'undefined' && window.navigator.userAgent.indexOf('MSIE') > -1) {
config.protocol = document.location.protocol.replace(':', '');
}
if (config.host) {

@@ -159,3 +160,3 @@ config.host.replace(/.*?:\/\//g, '');

if (typeof define !== 'undefined' && define.amd) {
define('keen-Client', [], function(){
define('keen-core', [], function(){
return Client;

@@ -162,0 +163,0 @@ });

{
"name": "keen-core",
"version": "0.0.1",
"version": "0.0.2",
"description": "Core functionality powering Keen IO's modular JavaScript SDKs",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

# keen-core.js
This module contains the core functionality powering both [keen-tracking.js](https://github.com/keen/keen-tracking.js) and [keen-analysis.js](https://github.com/keen/keen-analysis.js), and is not intended for direct use at this time.
Core functionality powering [keen-tracking.js](https://github.com/keen/keen-tracking.js) and [keen-analysis.js](https://github.com/keen/keen-analysis.js); not intended for direct use.
### Installation
```ssh
$ npm install keen-core --save
```
var test = require('tape');
var App = require('../lib/index');
var defaultProtocol = 'https';
if (typeof window !== 'undefined' && window.navigator.userAgent.indexOf('MSIE') > -1) {
defaultProtocol = document.location.protocol.replace(':', '');
}
test('Constructor', function(t) {
var app = new App();
t.equal(app instanceof App, true,
'Instantiation should return a new instance of the app');
'should return a new instance of the app');
t.end();
});
test('.configure()', function(t){
var app = new App().configure({
projectId: '123',
protocol: 'http',
host: 'none'
});
t.equal(app.config.projectId, '123',
'should set provided projectId');
t.equal(app.config.protocol, 'http',
'should set provided protocol');
t.equal(app.config.host, 'none',
'should set provided host');
app.configure({
projectId: '456',
host: 'mydomain.com'
});
t.equal(app.config.projectId, '456',
'should set provided projectId');
t.equal(app.config.host, 'mydomain.com',
'should set provided host');
t.end();
});
test('.masterKey()', function(t){

@@ -15,7 +52,11 @@ var app = new App({

});
t.equal(app.masterKey(), '123',
'Should get the correct masterKey value');
app.masterKey('456');
t.equal(app.masterKey(), '456',
'Should set the correct masterKey value');
t.end();

@@ -28,8 +69,52 @@ });

});
t.equal(app.projectId(), '123',
'Should get the correct projectId value');
app.projectId('456');
t.equal(app.projectId(), '456',
'Should set the correct projectId value');
t.end();
});
test('.resources()', function(t){
var app = new App();
t.equal(app.resources()['base'], '{protocol}://{host}',
'Should have the correct \'base\' resource');
app.resources({
'new': '{protocol}://{host}/my_api'
});
t.equal(app.resources()['new'], '{protocol}://{host}/my_api',
'Should set a \'new\' resource');
app.resources({
'new': null
});
t.equal(app.resources()['new'], null,
'Should unset a \'new\' resource');
t.end();
});
test('.url()', function(t){
var app = new App({
projectId: '123'
});
t.equal(app.url('base'), defaultProtocol + '://' + app.config.host,
'Should return the correct url for the \'base\' resource');
t.equal(app.url('projectId'), defaultProtocol + '://' + app.config.host + '/3.0/projects/123',
'Should return the correct url for the \'projectId\' resource');
t.equal(app.url('base', { key: true }), defaultProtocol + '://' + app.config.host + '?key=true',
'Should return the correct url with provided query params');
t.end();
});
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