New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

m8

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

m8 - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

17

package.json

@@ -8,3 +8,12 @@ {

"description" : "m8 is a small utility library you might find useful or just plain annoying.",
"devDependencies" : { "Templ8" : ">= 0.3.0", "mkdirp" : ">= 0.3.0", "mocha" : ">= 1.3.0", "uglify-js" : ">= 1.2.5" },
"devDependencies" : {
"Templ8" : ">= 0.3.0",
"chai" : ">= 1.2.0",
"mkdirp" : ">= 0.3.0",
"mocha" : ">= 1.3.0",
"uglify-js" : ">= 1.2.5"
},
"engines" : {
"node" : ">= 0.4.x"
},
"keywords" : ["api", "framework", "functional", "javascript", "library", "programming", "utility"],

@@ -15,3 +24,3 @@ "licenses" : [ {

} ],
"main" : "./m8.js",
"main" : "./m8",
"name" : "m8",

@@ -23,5 +32,5 @@ "repository" : {

"scripts" : {
"test" : "mocha -c --globals mocha,expect,m8 -R spec -u tdd ./test"
"test" : "mocha -c --ignore-leaks -R spec -u tdd ./test"
},
"version" : "0.2.2"
"version" : "0.2.3"
}

@@ -1,4 +0,6 @@

typeof m8 !== 'undefined' || ( m8 = require( 'm8' ) );
typeof expect !== 'undefined' || ( expect = require( 'expect.js' ) );
typeof m8 !== 'undefined' || ( m8 = require( 'm8' ) );
typeof chai !== 'undefined' || ( chai = require( 'chai' ) );
expect = chai.expect;
suite( 'm8', function() {

@@ -8,4 +10,4 @@ test( '<static> m8', function( done ) {

expect( m8( true ) ).to.be( true );
expect( m8( expected ) ).to.be( expected );
expect( m8( true ) ).to.equal( true );
expect( m8( expected ) ).to.equal( expected );

@@ -21,9 +23,9 @@ done();

if ( m8.ENV == 'commonjs' ) {
expect( m8.bless( 'foo.bar', module ) ).to.be( module.exports.foo.bar );
expect( m8.bless( 'foo.bar', module ) ).to.equal( module.exports.foo.bar );
module.exports.expected = expected;
expect( m8.bless( '^.foo.bar', module.exports.expected ) ).to.be( expected.foo.bar );
expect( m8.bless( '^.foo.bar', module.exports.expected ) ).to.equal( expected.foo.bar );
}
else {
expect( m8.bless( '^foo.bar', expected ) ).to.be( expected.bar );
expect( m8.bless( '^.bar' ) ).to.be( m8.global.bar );
expect( m8.bless( '^foo.bar', expected ) ).to.equal( expected.bar );
expect( m8.bless( '^.bar' ) ).to.equal( m8.global.bar );
}

@@ -37,15 +39,15 @@

test( '<static> m8.coerce', function( done ) {
expect( m8.coerce( 'false' ) ).to.be( false );
expect( m8.coerce( 'null' ) ).to.be( null );
expect( m8.coerce( 'true' ) ).to.be( true );
expect( m8.coerce( 'undefined' ) ).to.be( undefined );
expect( isNaN( m8.coerce( 'NaN' ) ) ).to.be( true );
expect( m8.coerce( '1' ) ).to.be( 1 );
expect( m8.coerce( '12' ) ).to.be( 12 );
expect( m8.coerce( '123' ) ).to.be( 123 );
expect( m8.coerce( '123.4' ) ).to.be( 123.4 );
expect( m8.coerce( '123.45' ) ).to.be( 123.45 );
expect( m8.coerce( '123.456' ) ).to.be( 123.456 );
expect( m8.coerce( '1e10' ) ).to.be( 10000000000 );
expect( m8.coerce( '.0000000001e10' ) ).to.be( 1 );
expect( m8.coerce( 'false' ) ).to.equal( false );
expect( m8.coerce( 'null' ) ).to.equal( null );
expect( m8.coerce( 'true' ) ).to.equal( true );
expect( m8.coerce( 'undefined' ) ).to.equal( undefined );
expect( isNaN( m8.coerce( 'NaN' ) ) ).to.equal( true );
expect( m8.coerce( '1' ) ).to.equal( 1 );
expect( m8.coerce( '12' ) ).to.equal( 12 );
expect( m8.coerce( '123' ) ).to.equal( 123 );
expect( m8.coerce( '123.4' ) ).to.equal( 123.4 );
expect( m8.coerce( '123.45' ) ).to.equal( 123.45 );
expect( m8.coerce( '123.456' ) ).to.equal( 123.456 );
expect( m8.coerce( '1e10' ) ).to.equal( 10000000000 );
expect( m8.coerce( '.0000000001e10' ) ).to.equal( 1 );

@@ -74,4 +76,4 @@ done();

expect( Object.keys( o ) ).to.eql( [] );
expect( delete o.foo ).to.be( false );
expect( delete o.bar ).to.be( true );
expect( delete o.foo ).to.equal( false );
expect( delete o.bar ).to.equal( true );

@@ -92,4 +94,4 @@ done();

expect( Object.keys( o ) ).to.eql( [] );
expect( delete o.foo ).to.be( true );
expect( delete o.bar ).to.be( true );
expect( delete o.foo ).to.equal( true );
expect( delete o.bar ).to.equal( true );

@@ -111,13 +113,13 @@ done();

test( '<static> m8.empty', function( done ) {
expect( m8.empty( '' ) ).to.be( true );
expect( m8.empty( [] ) ).to.be( true );
expect( m8.empty( NaN ) ).to.be( true );
expect( m8.empty( {} ) ).to.be( true );
expect( m8.empty( null ) ).to.be( true );
expect( m8.empty( undefined ) ).to.be( true );
expect( m8.empty() ).to.be( true );
expect( m8.empty( 0 ) ).to.be( false );
expect( m8.empty( ' ' ) ).to.be( false );
expect( m8.empty( [''] ) ).to.be( false );
expect( m8.empty( { foo : '' } ) ).to.be( false );
expect( m8.empty( '' ) ).to.equal( true );
expect( m8.empty( [] ) ).to.equal( true );
expect( m8.empty( NaN ) ).to.equal( true );
expect( m8.empty( {} ) ).to.equal( true );
expect( m8.empty( null ) ).to.equal( true );
expect( m8.empty( undefined ) ).to.equal( true );
expect( m8.empty() ).to.equal( true );
expect( m8.empty( 0 ) ).to.equal( false );
expect( m8.empty( ' ' ) ).to.equal( false );
expect( m8.empty( [''] ) ).to.equal( false );
expect( m8.empty( { foo : '' } ) ).to.equal( false );

@@ -128,8 +130,8 @@ done();

test( '<static> m8.exists', function( done ) {
expect( m8.exists( 0 ) ).to.be( true );
expect( m8.exists( false ) ).to.be( true );
expect( m8.exists( '' ) ).to.be( true );
expect( m8.exists( NaN ) ).to.be( false );
expect( m8.exists( null ) ).to.be( false );
expect( m8.exists( undefined ) ).to.be( false );
expect( m8.exists( 0 ) ).to.equal( true );
expect( m8.exists( false ) ).to.equal( true );
expect( m8.exists( '' ) ).to.equal( true );
expect( m8.exists( NaN ) ).to.equal( false );
expect( m8.exists( null ) ).to.equal( false );
expect( m8.exists( undefined ) ).to.equal( false );

@@ -142,9 +144,9 @@ done();

expect( m8.got( { foo : 'bar' }, 'foo' ) ).to.be( true );
expect( m8.got( [1, 2, 3], 'length' ) ).to.be( true );
expect( m8.got( { foo : 'bar' }, 'bar' ) ).to.be( false );
expect( m8.got( { foo : 'bar', baz : 'bam' }, 'foo', 'baz' ) ).to.be( true );
expect( m8.got( new Test(), 'foo', 'baz' ) ).to.be( true );
expect( m8.got( new Test(), 'baz', 'bam' ) ).to.be( true );
expect( m8.got( new Test( 'val' ), 'foo', 'bam', 'val' ) ).to.be( true );
expect( m8.got( { foo : 'bar' }, 'foo' ) ).to.equal( true );
expect( m8.got( [1, 2, 3], 'length' ) ).to.equal( true );
expect( m8.got( { foo : 'bar' }, 'bar' ) ).to.equal( false );
expect( m8.got( { foo : 'bar', baz : 'bam' }, 'foo', 'baz' ) ).to.equal( true );
expect( m8.got( new Test(), 'foo', 'baz' ) ).to.equal( true );
expect( m8.got( new Test(), 'baz', 'bam' ) ).to.equal( true );
expect( m8.got( new Test( 'val' ), 'foo', 'bam', 'val' ) ).to.equal( true );

@@ -157,9 +159,9 @@ done();

expect( m8.has( { foo : 'bar' }, 'foo' ) ).to.be( true );
expect( m8.has( [1, 2, 3], 'length' ) ).to.be( true );
expect( m8.has( { foo : 'bar' }, 'bar' ) ).to.be( false );
expect( m8.has( { foo : 'bar', baz : 'bam' }, 'foo', 'baz' ) ).to.be( true );
expect( m8.has( new Test(), 'foo', 'baz' ) ).to.be( false );
expect( m8.has( new Test(), 'bar', 'bam' ) ).to.be( false );
expect( m8.has( new Test( 'value' ), 'foo', 'bam', 'value' ) ).to.be( true );
expect( m8.has( { foo : 'bar' }, 'foo' ) ).to.equal( true );
expect( m8.has( [1, 2, 3], 'length' ) ).to.equal( true );
expect( m8.has( { foo : 'bar' }, 'bar' ) ).to.equal( false );
expect( m8.has( { foo : 'bar', baz : 'bam' }, 'foo', 'baz' ) ).to.equal( true );
expect( m8.has( new Test(), 'foo', 'baz' ) ).to.equal( false );
expect( m8.has( new Test(), 'bar', 'bam' ) ).to.equal( false );
expect( m8.has( new Test( 'value' ), 'foo', 'bam', 'value' ) ).to.equal( true );

@@ -173,3 +175,3 @@ done();

expect( m8.id( expected ) ).to.equal( 'foo' );
expect( empty_obj.id ).to.be( undefined );
expect( empty_obj.id ).to.equal( undefined );
expect( m8.id( empty_obj ) ).to.equal( empty_obj.id );

@@ -182,9 +184,9 @@ expect( m8.id( {}, 'foo' ).split( '-' )[0] ).to.equal( 'foo' );

test( '<static> m8.iter', function( done ) {
expect( m8.iter( [] ) ).to.be( true );
expect( m8.iter( {} ) ).to.be( true );
expect( m8.iter( m8.obj() ) ).to.be( true );
expect( m8.iter( '' ) ).to.be( true );
expect( m8.iter( null ) ).to.be( false );
expect( m8.iter( 3 ) ).to.be( false );
expect( m8.iter( new Date() ) ).to.be( false );
expect( m8.iter( [] ) ).to.equal( true );
expect( m8.iter( {} ) ).to.equal( true );
expect( m8.iter( m8.obj() ) ).to.equal( true );
expect( m8.iter( '' ) ).to.equal( true );
expect( m8.iter( null ) ).to.equal( false );
expect( m8.iter( 3 ) ).to.equal( false );
expect( m8.iter( new Date() ) ).to.equal( false );

@@ -205,6 +207,6 @@ done();

expect( returned ).not.to.be( expected );
expect( returned ).not.to.equal( expected );
expect( returned ).to.eql( expected );
expect( returned.items ).not.to.be( expected.items );
expect( returned.items[1].items[1] ).not.to.be( expected.items[1].items[1] );
expect( returned.items ).not.to.equal( expected.items );
expect( returned.items[1].items[1] ).not.to.equal( expected.items[1].items[1] );

@@ -236,3 +238,3 @@ done();

expect( m8.type( returned ) ).to.eql( 'nullobject' );
expect( Object.getPrototypeOf( returned ) ).to.be( null );
expect( Object.getPrototypeOf( returned ) ).to.equal( null );
expect( m8.nativeType( returned ) ).to.equal( 'object' );

@@ -296,8 +298,8 @@ expect( m8.nativeType( returned ) ).not.to.equal( 'nullobject' );

test( '<static> Boolean.coerce: returns true for true like Strings', function( done ) {
expect( Boolean.coerce( true ) ).to.be( true );
expect( Boolean.coerce( 'true' ) ).to.be( true );
expect( Boolean.coerce( 1 ) ).to.be( true );
expect( Boolean.coerce( '1' ) ).to.be( true );
expect( Boolean.coerce( 'some random string of text' ) ).to.be( true );
expect( Boolean.coerce( -1 ) ).to.be( true );
expect( Boolean.coerce( true ) ).to.equal( true );
expect( Boolean.coerce( 'true' ) ).to.equal( true );
expect( Boolean.coerce( 1 ) ).to.equal( true );
expect( Boolean.coerce( '1' ) ).to.equal( true );
expect( Boolean.coerce( 'some random string of text' ) ).to.equal( true );
expect( Boolean.coerce( -1 ) ).to.equal( true );

@@ -309,8 +311,8 @@ done();

test( '<static> Boolean.coerce: returns false for false like Strings', function( done ) {
expect( Boolean.coerce( false ) ).to.be( false ); expect( Boolean.coerce( 'false' ) ).to.be( false );
expect( Boolean.coerce( 0 ) ).to.be( false ); expect( Boolean.coerce( '0' ) ).to.be( false );
expect( Boolean.coerce( NaN ) ).to.be( false ); expect( Boolean.coerce( 'NaN' ) ).to.be( false );
expect( Boolean.coerce( null ) ).to.be( false ); expect( Boolean.coerce( 'null' ) ).to.be( false );
expect( Boolean.coerce( undefined ) ).to.be( false ); expect( Boolean.coerce( 'undefined' ) ).to.be( false );
expect( Boolean.coerce() ).to.be( false ); expect( Boolean.coerce( '' ) ).to.be( false );
expect( Boolean.coerce( false ) ).to.equal( false ); expect( Boolean.coerce( 'false' ) ).to.equal( false );
expect( Boolean.coerce( 0 ) ).to.equal( false ); expect( Boolean.coerce( '0' ) ).to.equal( false );
expect( Boolean.coerce( NaN ) ).to.equal( false ); expect( Boolean.coerce( 'NaN' ) ).to.equal( false );
expect( Boolean.coerce( null ) ).to.equal( false ); expect( Boolean.coerce( 'null' ) ).to.equal( false );
expect( Boolean.coerce( undefined ) ).to.equal( false ); expect( Boolean.coerce( 'undefined' ) ).to.equal( false );
expect( Boolean.coerce() ).to.equal( false ); expect( Boolean.coerce( '' ) ).to.equal( false );

@@ -343,3 +345,3 @@ done();

expect( one ).not.to.be( two );
expect( one ).not.to.equal( two );
expect( one ).not.to.equal( two );

@@ -354,3 +356,3 @@ expect( one.valueOf() ).to.equal( two.valueOf() );

expect( Object.key( { foo : 'bar' }, 'bar' ) ).to.equal( 'foo' );
expect( Object.key( { foo : 'bar' }, 'foo' ) ).to.be( null );
expect( Object.key( { foo : 'bar' }, 'foo' ) ).to.equal( null );

@@ -376,5 +378,5 @@ done();

expect( Object.value( d, 'one.two.four.2' ) ).to.eql( d.one.two.four[2] );
expect( Object.value( d, 'one.three.four.2' ) ).to.be( undefined );
expect( Object.value( d, 'one.two.beep.7' ) ).to.be( undefined );
expect( Object.value( d, 'one.two.four.7' ) ).to.be( undefined );
expect( Object.value( d, 'one.three.four.2' ) ).to.equal( undefined );
expect( Object.value( d, 'one.two.beep.7' ) ).to.equal( undefined );
expect( Object.value( d, 'one.two.four.7' ) ).to.equal( undefined );

@@ -381,0 +383,0 @@ done();

Sorry, the diff of this file is not supported yet

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