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

set-component

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

set-component - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

components/component-enumerable/component.json

109

build/build.js

@@ -26,3 +26,3 @@ /**

mod.client = mod.component = true;
mod.call(mod.exports, mod, mod.exports, require.relative(path));
mod.call(this, mod, mod.exports, require.relative(path));
}

@@ -87,3 +87,3 @@

// foo
if ('.' != path[0]) return path;
if ('.' != path.charAt(0)) return path;

@@ -142,2 +142,14 @@ curr = curr.split('/');

/**
* lastIndexOf helper.
*/
function lastIndexOf(arr, obj){
var i = arr.length;
while (i--) {
if (arr[i] === obj) return i;
}
return -1;
}
/**
* The relative require() itself.

@@ -162,5 +174,5 @@ */

// directory
if ('.' != path[0]) {
if ('.' != path.charAt(0)) {
var segs = parent.split('/');
var i = segs.lastIndexOf('deps') + 1;
var i = lastIndexOf(segs, 'deps') + 1;
if (!i) i = 0;

@@ -194,6 +206,77 @@ path = segs.slice(0, i + 1).join('/') + '/deps/' + path;

});
require.register("component-stack/index.js", function(module, exports, require){
/**
* Expose `stack()`.
*/
module.exports = stack;
/**
* Return the stack.
*
* @return {Array}
* @api public
*/
function stack() {
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error;
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
return stack;
}
});
require.register("component-assert/index.js", function(module, exports, require){
/**
* Module dependencies.
*/
var stack = require('stack');
/**
* Load contents of `script`.
*
* @param {String} script
* @return {String}
* @api private
*/
function getScript(script) {
var xhr = new XMLHttpRequest;
xhr.open('GET', script, false);
xhr.send(null);
return xhr.responseText;
}
/**
* Assert `expr` with optional failure `msg`.
*
* @param {Mixed} expr
* @param {String} [msg]
* @api public
*/
module.exports = function(expr, msg){
if (!expr) throw new Error(msg || 'assertion failed');
if (expr) return;
if (!msg) {
if (Error.captureStackTrace) {
var callsite = stack()[1];
var fn = callsite.fun.toString();
var file = callsite.getFileName();
var line = callsite.getLineNumber() - 1;
var col = callsite.getColumnNumber() - 1;
var src = getScript(file);
line = src.split('\n')[line].slice(col);
expr = line.match(/assert\((.*)\)/)[1].trim();
msg = expr;
} else {
msg = 'assertion failed';
}
}
throw new Error(msg);
};

@@ -257,2 +340,17 @@ });

/**
* Iterate each member and invoke `fn(val)`.
*
* @param {Function} fn
* @return {Set}
* @api public
*/
Set.prototype.each = function(fn){
for (var i = 0; i < this.vals.length; ++i) {
fn(this.vals[i]);
}
return this;
};
/**
* Return the values as an array.

@@ -368,1 +466,2 @@ *

require.alias("component-assert/index.js", "set/deps/assert/index.js");
require.alias("component-stack/index.js", "component-assert/deps/stack/index.js");

2

component.json
{
"name": "set",
"version": "0.0.3",
"version": "0.0.4",
"description": "set container",

@@ -5,0 +5,0 @@ "keywords": ["set"],

{
"name": "assert",
"description": "Assertion lib",
"version": "0.0.1",
"version": "0.1.1",
"keywords": [

@@ -9,3 +9,5 @@ "assert",

],
"dependencies": {},
"dependencies": {
"component/stack": "*"
},
"scripts": [

@@ -12,0 +14,0 @@ "index.js"

/**
* Module dependencies.
*/
var stack = require('stack');
/**
* Load contents of `script`.
*
* @param {String} script
* @return {String}
* @api private
*/
function getScript(script) {
var xhr = new XMLHttpRequest;
xhr.open('GET', script, false);
xhr.send(null);
return xhr.responseText;
}
/**
* Assert `expr` with optional failure `msg`.
*
* @param {Mixed} expr
* @param {String} [msg]
* @api public
*/
module.exports = function(expr, msg){
if (!expr) throw new Error(msg || 'assertion failed');
if (expr) return;
if (!msg) {
if (Error.captureStackTrace) {
var callsite = stack()[1];
var fn = callsite.fun.toString();
var file = callsite.getFileName();
var line = callsite.getLineNumber() - 1;
var col = callsite.getColumnNumber() - 1;
var src = getScript(file);
line = src.split('\n')[line].slice(col);
expr = line.match(/assert\((.*)\)/)[1].trim();
msg = expr;
} else {
msg = 'assertion failed';
}
}
throw new Error(msg);
};
0.0.4 / 2012-10-17
==================
* add `Set#each(fn)`
0.0.3 / 2012-09-18

@@ -3,0 +8,0 @@ ==================

@@ -56,2 +56,17 @@

/**
* Iterate each member and invoke `fn(val)`.
*
* @param {Function} fn
* @return {Set}
* @api public
*/
Set.prototype.each = function(fn){
for (var i = 0; i < this.vals.length; ++i) {
fn(this.vals[i]);
}
return this;
};
/**
* Return the values as an array.

@@ -58,0 +73,0 @@ *

{
"name": "set-component",
"version": "0.0.3",
"version": "0.0.4",
"description": "Set container",

@@ -5,0 +5,0 @@ "keywords": ["set"],

@@ -56,2 +56,6 @@

### Set#each(fn)
Iterate each member and invoke `fn(val)`.
### Set#size()

@@ -58,0 +62,0 @@

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