Permalink
Browse files

added m8.ntype alias for m8.nativeType

added m8.description as shorthand for Object.getOwnPropertyDescriptor
  • Loading branch information...
1 parent 0556d57 commit a9c999b10d375ad4278f14e541772107c7b3bfd9 @constantology committed Nov 1, 2012
Showing with 31 additions and 25 deletions.
  1. +12 −9 m8.js
  2. +1 −1 m8.min.js
  3. +7 −7 src/expose.js
  4. +5 −2 src/lib.js
  5. +6 −6 test/m8.test.js
View
21 m8.js
@@ -98,7 +98,7 @@
case 'object' : mode = args.shift(); break;
default :
ntype = nativeType( desc );
- mode = ntype != 'object' && defined ? Object.getOwnPropertyDescriptor( item, name ) : null;
+ mode = ntype != 'object' && defined ? description( item, name ) : null;
!mode || ( mode = ntype == 'function' ? modes.cw : modes.cew );
}
overwrite = args.shift() === true;
@@ -125,6 +125,9 @@
function describe( desc, mode ) {
return copy( ( nativeType( desc ) == 'object' ? desc : { value : desc } ), ( nativeType( mode ) == 'object' ? mode : modes[String( mode ).toLowerCase()] || modes.cew ), true );
}
+ function description( item, property ) {
+ return Object.getOwnPropertyDescriptor( item, property );
+ }
function empty( item ) { return !exists( item ) || ( !len( item ) && iter( item ) ) || false; }
function exists( item ) { return !( item === null || item === UNDEF || ( typeof item == 'number' && isNaN( item ) ) ); }
@@ -233,7 +236,7 @@
if ( test( item, property ) )
return true;
-
+
if ( typeof item != 'string' && !!~property.indexOf( '.' ) ) {
property = property.split( '.' );
@@ -465,14 +468,14 @@
defs( ( __lib__ = expose( __lib__, Name, PACKAGE ) ), {
// properties
- ENV : ENV, global : { value : root }, modes : { value : modes },
+ ENV : ENV, global : { value : root }, modes : { value : modes },
// methods
- bless : bless, coerce : coerce, copy : copy, def : def, defs : defs,
- describe : describe, empty : empty, exists : exists, expose : expose,
- got : property_exists.bind( null, got ), guid : guid, has : property_exists.bind( null, has ),
- id : id, iter : iter, len : len, merge : merge, nativeType : nativeType,
- noop : noop, obj : obj, range : range, remove : remove, tostr : tostr,
- type : type, update : update, valof : valof, x : x
+ bless : bless, coerce : coerce, copy : copy, def : def, defs : defs,
+ describe : describe, description : description, empty : empty, exists : exists, expose : expose,
+ got : property_exists.bind( null, got ), guid : guid, has : property_exists.bind( null, has ),
+ id : id, iter : iter, len : len, merge : merge, nativeType : nativeType,
+ noop : noop, ntype : nativeType, obj : obj, range : range, remove : remove,
+ tostr : tostr, type : type, update : update, valof : valof, x : x
}, 'w' );
x( Object, Array, Boolean, Function );
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -2,14 +2,14 @@
defs( ( __lib__ = expose( __lib__, Name, PACKAGE ) ), {
// properties
- ENV : ENV, global : { value : root }, modes : { value : modes },
+ ENV : ENV, global : { value : root }, modes : { value : modes },
// methods
- bless : bless, coerce : coerce, copy : copy, def : def, defs : defs,
- describe : describe, empty : empty, exists : exists, expose : expose,
- got : property_exists.bind( null, got ), guid : guid, has : property_exists.bind( null, has ),
- id : id, iter : iter, len : len, merge : merge, nativeType : nativeType,
- noop : noop, obj : obj, range : range, remove : remove, tostr : tostr,
- type : type, update : update, valof : valof, x : x
+ bless : bless, coerce : coerce, copy : copy, def : def, defs : defs,
+ describe : describe, description : description, empty : empty, exists : exists, expose : expose,
+ got : property_exists.bind( null, got ), guid : guid, has : property_exists.bind( null, has ),
+ id : id, iter : iter, len : len, merge : merge, nativeType : nativeType,
+ noop : noop, ntype : nativeType, obj : obj, range : range, remove : remove,
+ tostr : tostr, type : type, update : update, valof : valof, x : x
}, 'w' );
x( Object, Array, Boolean, Function );
Oops, something went wrong.

0 comments on commit a9c999b

Please sign in to comment.