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

lazy-ass

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lazy-ass - npm Package Compare versions

Comparing version 0.6.0 to 1.0.0

test/commonjs.spec.js

2

bower.json
{
"name": "lazy-ass",
"main": "index.js",
"version": "0.6.0",
"version": "1.0.0",
"homepage": "https://github.com/bahmutov/lazy-ass",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -101,24 +101,41 @@ (function initLazyAss() {

function register(value, name) {
var registered;
if (typeof window === 'object') {
/* global window */
window[name] = value;
registered = true;
}
if (typeof global === 'object') {
global[name] = value;
registered = true;
}
lazyAss.async = lazyAssync;
if (!registered) {
throw new Error('Do not know how to register ' + name);
function isNode() {
return typeof global === 'object';
}
function isBrowser() {
return typeof window === 'object';
}
function isCommonJS() {
return typeof module === 'object';
}
function globalRegister() {
if (isNode()) {
/* global global */
register(global, lazyAss, 'lazyAss', 'la');
register(global, lazyAssync, 'lazyAssync', 'lac');
}
}
register(lazyAss, 'lazyAss');
register(lazyAss, 'la');
register(lazyAssync, 'lazyAssync');
register(lazyAssync, 'lac');
function register(root, value, name, alias) {
root[name] = root[alias] = value;
}
lazyAss.globalRegister = globalRegister;
if (isBrowser()) {
/* global window */
register(window, lazyAss, 'lazyAss', 'la');
register(window, lazyAssync, 'lazyAssync', 'lac');
}
if (isCommonJS()) {
/* global module */
module.exports = lazyAss;
}
}());
{
"name": "lazy-ass",
"description": "Lazy assertions without performance penalty",
"version": "0.6.0",
"version": "1.0.0",
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>",

@@ -9,3 +9,18 @@ "bugs": {

},
"config": {
"pre-git": {
"commit-msg": "validate-commit-msg",
"pre-commit": [
"npm test",
"npm version"
],
"pre-push": [],
"post-commit": [],
"post-merge": []
}
},
"contributors": [],
"czConfig": {
"path": "node_modules/pre-git/node_modules/cz-conventional-changelog"
},
"dependencies": {},

@@ -37,4 +52,4 @@ "devDependencies": {

"matchdep": "0.3.0",
"mocha": "2.2.4",
"pre-git": "0.2.1",
"mocha": "2.3.3",
"pre-git": "1.2.4",
"time-grunt": "1.1.1"

@@ -57,6 +72,2 @@ },

"main": "index.js",
"pre-commit": [
"npm test",
"npm version"
],
"repository": {

@@ -68,6 +79,8 @@ "type": "git",

"test": "grunt test",
"mocha": "mocha test/*.spec.js",
"watch": "grunt watch",
"coveralls": "cat coverage/PhantomJS*/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"demo": "grunt gh-pages"
"demo": "grunt gh-pages",
"commit": "commit-wizard"
}
}

@@ -57,4 +57,5 @@ # lazy-ass

Node: `npm install lazy-ass --save` then `require('lazy-ass');`,
attaches functions `lazyAss` and `la` to `global` object.
Node: `npm install lazy-ass --save` then `var la = require('lazy-ass');`.
You can attach the methods to the global object using
`require('lazy-ass').globalRegister();`.

@@ -95,3 +96,3 @@ Browser: `bower install lazy-ass --save`, include `index.js`,

```js
lazyAssync(false, 'foo');
lazyAss.async(false, 'foo');
console.log('after assync');

@@ -98,0 +99,0 @@ // output

@@ -1,6 +0,5 @@

require('..');
/* global lazyAss */
var lazyAss = require('..');
function bad(foo, bar) {
lazyAss(false, 'this fails, foo =', foo, 'bar =', bar);
lazyAss(false, 'this fails on purpose, foo =', foo, 'bar =', bar);
}
bad('foo', 'bar');
/* global lazyAss, la */
(function (root) {
if (typeof window === 'undefined') {
require('..'); // Node
}
if (typeof lazyAss === 'undefined') {
throw new Error('Cannot find lazyAss global varible');
}
if (typeof root.expect === 'undefined') {
root.expect = require('expect.js');
}
var expect = root.expect;
describe('lazyAss', function () {
beforeEach(function () {
if (typeof window === 'undefined') {
require('..').globalRegister(); // Node
}
if (typeof lazyAss === 'undefined') {
throw new Error('Cannot find lazyAss global varible');
}
if (typeof root.expect === 'undefined') {
root.expect = require('expect.js');
expect = root.expect;
}
});
describe('lazyAss function itself', function () {

@@ -17,0 +20,0 @@ it('is a function', function () {

/* global lazyAssync, lac */
(function (root) {
if (typeof window === 'undefined') {
require('..'); // Node
require('..').globalRegister(); // Node
}

@@ -6,0 +6,0 @@ if (typeof lazyAssync === 'undefined') {

Sorry, the diff of this file is not supported yet

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