Changes

Jump to navigation Jump to search
m
no edit summary
Line 30: Line 30:     
         // the list of private helper functions, could not be accessed from outside
 
         // the list of private helper functions, could not be accessed from outside
         function indexinterpolate(obj,i) { return  (obj[i] != undefined) ? obj[i] : obj};  
+
         function indexinterpolate(obj,i) { return  (obj[i] !== undefined) ? obj[i] : obj};  
 
         // helper function for checking a part of an array exists
 
         // helper function for checking a part of an array exists
         function indexcheck(obj,i) {  if ( obj != undefined) { return  (obj[i] != undefined) ? obj[i] : undefined } };
+
         function indexcheck(obj,i) {  if ( obj !== undefined) { return  (obj[i] !== undefined) ? obj[i] : undefined } };
 
         // dive selects matrix.a.b.c.d from the array called matrix and 'a.b.c.d' as string
 
         // dive selects matrix.a.b.c.d from the array called matrix and 'a.b.c.d' as string
 
         // if a.b.c.d does not exists, it returns the substructure until the substructure exists, if d does not exist, it returns matrix.a.b.c e.g.
 
         // if a.b.c.d does not exists, it returns the substructure until the substructure exists, if d does not exist, it returns matrix.a.b.c e.g.
 
          
 
          
 
         function dive(array, read){
 
         function dive(array, read){
             return read.split('.').reduce(indexinterpolate, array);
+
             return (read + '').split('.').reduce(indexinterpolate, array);
 
         }
 
         }
 
          
 
          
 
         function check(array, read){
 
         function check(array, read){
             if ( array != undefined ) {
+
             if ( array !== undefined ) {
                 return read.split('.').reduce(indexcheck, array);
+
                 return (read + '').split('.').reduce(indexcheck, array);
 
             }
 
             }
 
         }
 
         }
 
          
 
          
 
         function checkdive( array, read){
 
         function checkdive( array, read){
             if ( check(array, read) != undefined) {
+
             if ( check(array, read) !== undefined) {
 
                 return dive(array, read);
 
                 return dive(array, read);
 
             } else if ( Array.isArray(array) ) {
 
             } else if ( Array.isArray(array) ) {
Line 77: Line 77:     
         function rise(array, to_push) {
 
         function rise(array, to_push) {
             if ( to_push != undefined) {
+
             if ( to_push !== undefined) {
 
                 if ( Object.keys(to_push).length > 0 ){
 
                 if ( Object.keys(to_push).length > 0 ){
 
                     Object.keys(to_push).forEach( function(item){
 
                     Object.keys(to_push).forEach( function(item){
                         if ( array != undefined ) {
+
                         if ( array !== undefined ) {
 
                             array.push(to_push[item]);
 
                             array.push(to_push[item]);
 
                         }
 
                         }
530

edits

Navigation menu