New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.3 to 0.1.0

6

CHANGELOG.md

@@ -8,3 +8,9 @@ <!--

-->
<a name="0.1.0"></a>
# 0.1.0 Manage modular namespace
**FIXED:**
* Modular SDKs containing this release will coalesce into a shared global namespace, rather than colliding and overwriting one another, and will store a reference to legacy versions of keen-js when detected. This legacy version can be referenced with `Keen.legacyVersion`, or returned to the `Keen` namespace by calling `var ModularLibs = Keen.noConflict();`.
<a name="0.0.2"></a>

@@ -11,0 +17,0 @@ # 0.0.2 RequireJS fix

88

lib/index.js

@@ -1,11 +0,10 @@

var each = require('./utils/each'),
extend = require('./utils/extend'),
parseParams = require('./utils/parse-params'),
serialize = require('./utils/serialize');
(function(env){
var previousKeen = env.Keen || undefined;
var each = require('./utils/each'),
extend = require('./utils/extend'),
parseParams = require('./utils/parse-params'),
serialize = require('./utils/serialize');
var Emitter = require('component-emitter');
var Emitter = require('component-emitter');
(function(env){
var initialKeen = typeof env.Keen !== 'undefined' ? env.Keen : undefined;
function Client(props){

@@ -25,2 +24,6 @@ if (this instanceof Client === false) {

if (previousKeen && typeof previousKeen.resources === 'undefined') {
Client.legacyVersion = previousKeen;
}
Emitter(Client);

@@ -33,17 +36,43 @@ Emitter(Client.prototype);

loaded: false,
resources: {
'base' : '{protocol}://{host}',
'version' : '{protocol}://{host}/3.0',
'projects' : '{protocol}://{host}/3.0/projects',
'projectId' : '{protocol}://{host}/3.0/projects/{projectId}'
},
utils: {
'each' : each,
'extend' : extend,
'parseParams' : parseParams,
'serialize' : serialize
},
version: '__VERSION__'
});
// Set or extend helpers
Client.helpers = Client.helpers || {};
// Set or extend resources
Client.resources = Client.resources || {};
extend(Client.resources, {
'base' : '{protocol}://{host}',
'version' : '{protocol}://{host}/3.0',
'projects' : '{protocol}://{host}/3.0/projects',
'projectId' : '{protocol}://{host}/3.0/projects/{projectId}'
});
// Set or extend utils
Client.utils = Client.utils || {};
extend(Client.utils, {
'each' : each,
'extend' : extend,
'parseParams' : parseParams,
'serialize' : serialize
});
Client.extendLibrary = function(target, source) {
var previous = previousKeen || source;
if (typeof previous !== 'undefined') {
each(previous, function(value, key) {
if (typeof value === 'object') {
target[key] = target[key] || {};
extend(target[key], value);
}
else {
target[key] = target[key] || value;
}
});
extend(target.prototype, previous.prototype);
}
return target;
};
Client.log = function(str){

@@ -56,3 +85,5 @@ if (Client.debug && typeof console === 'object') {

Client.noConflict = function(){
env.Keen = initialKeen;
if (typeof env.Keen !== 'undefined') {
env.Keen = Client.legacyVersion || previousKeen;
}
return Client;

@@ -188,17 +219,8 @@ };

// Module Definitions
// --------------------
// Global
if (env) {
env.Keen = Client;
function isUndefined(target) {
return typeof target === 'undefined';
}
// CommonJS
if (typeof module !== 'undefined' && module.exports) {
module.exports = Client;
}
module.exports = Client;
/* RequireJS defintion not necessary */
}).call(this, typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {});
{
"name": "keen-core",
"version": "0.0.3",
"version": "0.1.0",
"description": "Core functionality powering Keen IO's modular JavaScript SDKs",

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

@@ -119,1 +119,35 @@ var test = require('tape');

});
test('.extendLibrary()', function(t){
var test = {
'boolean': true,
'function': function(){},
'number': 123,
'object': {
'nested': {
'value': 987
}
},
'string': 'some-string',
'prototype': {
'method': function(a, b){ return a + b; }
}
};
App.extendLibrary(App, test);
t.equal(App.boolean, test.boolean,
'Should return an inherited boolean');
t.equal(App.function, test.function,
'Should return an inherited function');
t.equal(App.number, test.number,
'Should return an inherited number');
t.equal(App.string, test.string,
'Should return an inherited string');
t.equal(App.object.nested.value, test.object.nested.value,
'Should return an inherited object');
t.equal(App.prototype.method, test.prototype.method,
'Should return an inherited prototype method');
var app = new App();
t.equal(app.method(1, 2), 3,
'Should return an appropriate value from the prototype method');
});
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