mirror of
				https://github.com/JuanCanham/HackMyResume.git
				synced 2025-11-03 22:37:27 +00:00 
			
		
		
		
	Add IIFE.
This commit is contained in:
		@@ -1,9 +1,11 @@
 | 
			
		||||
/**
 | 
			
		||||
The HackMyResume date representation.
 | 
			
		||||
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
 | 
			
		||||
@module fluent-date.js
 | 
			
		||||
@license MIT. See LICENSE.md for details.
 | 
			
		||||
@module core/fluent-date
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
(function(){
 | 
			
		||||
 | 
			
		||||
  var moment = require('moment');
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
@@ -26,7 +28,10 @@ function FluentDate( dt ) {
 | 
			
		||||
    this.rep = this.fmt( dt );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
FluentDate/*.prototype*/.fmt = function( dt ) {
 | 
			
		||||
  FluentDate/*.prototype*/.fmt = function( dt, throws ) {
 | 
			
		||||
 | 
			
		||||
    throws = (throws === undefined || throws === null) || throws;
 | 
			
		||||
 | 
			
		||||
    if( (typeof dt === 'string' || dt instanceof String) ) {
 | 
			
		||||
      dt = dt.toLowerCase().trim();
 | 
			
		||||
      if( /^(present|now|current)$/.test(dt) ) { // "Present", "Now"
 | 
			
		||||
@@ -63,7 +68,9 @@ FluentDate/*.prototype*/.fmt = function( dt ) {
 | 
			
		||||
        var mt = moment( dt );
 | 
			
		||||
        if(mt.isValid())
 | 
			
		||||
          return mt;
 | 
			
		||||
        if( throws )
 | 
			
		||||
          throw 'Invalid date format encountered.';
 | 
			
		||||
        return null;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
@@ -72,7 +79,9 @@ FluentDate/*.prototype*/.fmt = function( dt ) {
 | 
			
		||||
      }
 | 
			
		||||
      else if( dt.isValid && dt.isValid() )
 | 
			
		||||
        return dt;
 | 
			
		||||
      if( throws )
 | 
			
		||||
        throw 'Unknown date object encountered.';
 | 
			
		||||
      return null;
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@@ -82,3 +91,5 @@ moment.monthsShort().forEach(function(m,idx){abbr[m.toLowerCase()]=idx+1;});
 | 
			
		||||
  abbr.sept = 9;
 | 
			
		||||
 | 
			
		||||
  module.exports = FluentDate;
 | 
			
		||||
 | 
			
		||||
}());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user