@@ -256,36 +256,36 @@ class DiasporaAdapter extends SequentialEvent {
256256 */
257257 matchEntity ( query , entity ) {
258258 const matchResult = _ . every ( _ . toPairs ( query ) , ( [ key , desc ] ) => {
259- if ( c . object ( desc ) ) {
259+ if ( _ . isObject ( desc ) ) {
260260 const entityVal = entity [ key ] ;
261261 return _ . every ( desc , ( val , operation ) => {
262262 switch ( operation ) {
263263 case '$exists' : {
264- return val === ! c . undefined ( entityVal ) ;
264+ return val === ! _ . isUndefined ( entityVal ) ;
265265 }
266266
267267 case '$equal' : {
268- return ! c . undefined ( entityVal ) && entityVal === val ;
268+ return ! _ . isUndefined ( entityVal ) && entityVal === val ;
269269 }
270270
271271 case '$diff' : {
272- return ! c . undefined ( entityVal ) && entityVal !== val ;
272+ return ! _ . isUndefined ( entityVal ) && entityVal !== val ;
273273 }
274274
275275 case '$less' : {
276- return ! c . undefined ( entityVal ) && entityVal < val ;
276+ return ! _ . isUndefined ( entityVal ) && entityVal < val ;
277277 }
278278
279279 case '$lessEqual' : {
280- return ! c . undefined ( entityVal ) && entityVal <= val ;
280+ return ! _ . isUndefined ( entityVal ) && entityVal <= val ;
281281 }
282282
283283 case '$greater' : {
284- return ! c . undefined ( entityVal ) && entityVal > val ;
284+ return ! _ . isUndefined ( entityVal ) && entityVal > val ;
285285 }
286286
287287 case '$greaterEqual' : {
288- return ! c . undefined ( entityVal ) && entityVal >= val ;
288+ return ! _ . isUndefined ( entityVal ) && entityVal >= val ;
289289 }
290290 }
291291 return false ;
@@ -298,7 +298,7 @@ class DiasporaAdapter extends SequentialEvent {
298298
299299 applyUpdateEntity ( update , entity ) {
300300 _ . forEach ( update , ( val , key ) => {
301- if ( c . undefined ( val ) ) {
301+ if ( _ . isUndefined ( val ) ) {
302302 delete entity [ key ] ;
303303 } else {
304304 entity [ key ] = val ;
@@ -322,7 +322,7 @@ class DiasporaAdapter extends SequentialEvent {
322322 if ( _ . isString ( limitOpt ) ) {
323323 limitOpt = parseInt ( limitOpt ) ;
324324 }
325- if ( ! ( c . integer ( limitOpt ) || Infinity === limitOpt ) || limitOpt < 0 ) {
325+ if ( ! ( _ . isInteger ( limitOpt ) || Infinity === limitOpt ) || limitOpt < 0 ) {
326326 throw new TypeError ( `Expect "options.limit" to be an integer equal to or above 0, have ${ limitOpt } ` ) ;
327327 }
328328 opts . limit = limitOpt ;
@@ -332,7 +332,7 @@ class DiasporaAdapter extends SequentialEvent {
332332 if ( _ . isString ( skipOpt ) ) {
333333 skipOpt = parseInt ( skipOpt ) ;
334334 }
335- if ( ! c . integer ( skipOpt ) || skipOpt < 0 || ! isFinite ( skipOpt ) ) {
335+ if ( ! _ . isInteger ( skipOpt ) || skipOpt < 0 || ! isFinite ( skipOpt ) ) {
336336 throw new TypeError ( `Expect "options.skip" to be a finite integer equal to or above 0, have ${ skipOpt } ` ) ;
337337 }
338338 opts . skip = skipOpt ;
@@ -351,7 +351,7 @@ class DiasporaAdapter extends SequentialEvent {
351351 if ( _ . isString ( pageOpt ) ) {
352352 pageOpt = parseInt ( pageOpt ) ;
353353 }
354- if ( ! c . integer ( pageOpt ) || pageOpt < 0 ) {
354+ if ( ! _ . isInteger ( pageOpt ) || pageOpt < 0 ) {
355355 throw new TypeError ( `Expect "options.page" to be an integer equal to or above 0, have ${ pageOpt } ` ) ;
356356 }
357357 opts . skip = pageOpt * opts . limit ;
@@ -403,7 +403,7 @@ class DiasporaAdapter extends SequentialEvent {
403403 } ) ;
404404 // For arithmetic comparison, check if values are numeric (TODO later: support date)
405405 _ . forEach ( [ '$less' , '$lessEqual' , '$greater' , '$greaterEqual' ] , operation => {
406- if ( attrSearch . hasOwnProperty ( operation ) && ! c . number ( attrSearch [ operation ] ) ) {
406+ if ( attrSearch . hasOwnProperty ( operation ) && ! _ . isNumber ( attrSearch [ operation ] ) ) {
407407 throw new TypeError ( `Expect "${ operation } " in ${ JSON . stringify ( attrSearch ) } to be a numeric value` ) ;
408408 }
409409 } ) ;
@@ -992,7 +992,7 @@ class LocalStorageDiasporaAdapter extends DiasporaAdapter {
992992 */
993993 static applyOptionsToSet ( set , options ) {
994994 if ( options . hasOwnProperty ( 'limit' ) ) {
995- if ( c . integer ( options . limit ) ) {
995+ if ( _ . isInteger ( options . limit ) ) {
996996 set = set . slice ( 0 , options . limit ) ;
997997 } else {
998998 ModelExtension . log . warn ( `Trying to apply a non-integer limit "${ options . limit } ".` ) ;
@@ -1104,7 +1104,7 @@ class LocalStorageDiasporaAdapter extends DiasporaAdapter {
11041104 _ . defaults ( options , {
11051105 skip : 0 ,
11061106 } ) ;
1107- if ( ! c . object ( queryFind ) ) {
1107+ if ( ! _ . isObject ( queryFind ) ) {
11081108 return this . findOneById ( table , queryFind ) ;
11091109 } else if ( _ . isEqual ( _ . keys ( queryFind ) , [ 'id' ] ) && _ . isEqual ( _ . keys ( queryFind . id ) , [ '$equal' ] ) ) {
11101110 return this . findOneById ( table , queryFind . id . $equal ) ;
@@ -1457,7 +1457,7 @@ const Diaspora = {
14571457 * @returns {Error[] } Array of errors
14581458 */
14591459 checkField ( value , fieldDesc , keys ) {
1460- if ( ! c . object ( fieldDesc ) ) {
1460+ if ( ! _ . isObject ( fieldDesc ) ) {
14611461 return ;
14621462 }
14631463 _ . defaults ( fieldDesc , {
@@ -1530,7 +1530,7 @@ const Diaspora = {
15301530 if ( ! tester . object ( value ) ) {
15311531 errors . push ( `${ keys . join ( '.' ) } expected to be a ${ fieldDesc . type } ` ) ;
15321532 } else {
1533- const deepTest = c . object (
1533+ const deepTest = _ . isObject (
15341534 fieldDesc . attributes
15351535 ) ? _ ( value ) . mapValues (
15361536 ( propVal , propName ) => this . checkField (
@@ -1549,7 +1549,7 @@ const Diaspora = {
15491549 if ( ! tester . array ( value ) ) {
15501550 errors . push ( `${ keys . join ( '.' ) } expected to be a ${ fieldDesc . type } ` ) ;
15511551 } else {
1552- const deepTest = c . object (
1552+ const deepTest = _ . isObject (
15531553 fieldDesc . of
15541554 ) ? _ ( value ) . map (
15551555 ( propVal , propName ) => {
@@ -1586,9 +1586,9 @@ const Diaspora = {
15861586 if ( ! _ . isNil ( fieldDesc . enum ) ) {
15871587 const result = _ . some ( fieldDesc . enum , enumVal => {
15881588 if ( c . instance ( enumVal , RegExp ) ) {
1589- return c . match ( value , enumVal ) ;
1589+ return null !== enumVal . exec ( value ) ;
15901590 } else {
1591- return c . equal ( value , enumVal ) ;
1591+ return value === enumVal ;
15921592 }
15931593 } ) ;
15941594 if ( false === result ) {
@@ -1634,7 +1634,7 @@ const Diaspora = {
16341634 */
16351635 defaultField ( value , fieldDesc ) {
16361636 let out ;
1637- if ( c . not . undefined ( value ) ) {
1637+ if ( ! _ . isUndefined ( value ) ) {
16381638 out = value ;
16391639 } else {
16401640 out = _ . isFunction ( fieldDesc . default ) ? fieldDesc . default ( ) : fieldDesc . default ;
@@ -1720,7 +1720,7 @@ const Diaspora = {
17201720 if ( ! _ . isString ( name ) && name . length > 0 ) {
17211721 throw new Error ( `DataSource name must be a non empty string, had "${ name } "` ) ;
17221722 }
1723- if ( ! c . object ( modelDesc ) ) {
1723+ if ( ! _ . isObject ( modelDesc ) ) {
17241724 throw new Error ( '"modelDesc" must be an object' ) ;
17251725 }
17261726 const model = new Model ( moduleName , name , modelDesc ) ;
@@ -2033,14 +2033,14 @@ class Model {
20332033 if ( 0 !== reservedPropIntersect . length ) {
20342034 throw new Error ( `${ JSON . stringify ( reservedPropIntersect ) } is/are reserved property names. To match those column names in data source, please use the data source mapper property` ) ;
20352035 }
2036- if ( ! modelDesc . hasOwnProperty ( 'sources' ) || ! ( _ . isArrayLike ( modelDesc . sources ) || c . object ( modelDesc . sources ) ) ) {
2036+ if ( ! modelDesc . hasOwnProperty ( 'sources' ) || ! ( _ . isArrayLike ( modelDesc . sources ) || _ . isObject ( modelDesc . sources ) ) ) {
20372037 throw new TypeError ( `Expect model sources to be either an array or an object, had ${ JSON . stringify ( modelDesc . sources ) } .` ) ;
20382038 }
20392039 // Normalize our sources: normalized form is an object with keys corresponding to source name, and key corresponding to remaps
20402040 const sourcesNormalized = _ . isArrayLike ( modelDesc . sources ) ? _ . zipObject ( modelDesc . sources , _ . times ( modelDesc . sources . length , _ . constant ( { } ) ) ) : _ . mapValues ( modelDesc . sources , ( remap , dataSourceName ) => {
20412041 if ( true === remap ) {
20422042 return { } ;
2043- } else if ( c . object ( remap ) ) {
2043+ } else if ( _ . isObject ( remap ) ) {
20442044 return remap ;
20452045 } else {
20462046 throw new TypeError ( `Datasource "${ dataSourceName } " value is invalid: expect \`true\` or a remap hash, but have ${ JSON . stringify ( remap ) } ` ) ;
0 commit comments