daily pastebin goal
74%
SHARE
TWEET

Untitled

a guest Jan 21st, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. const moment = require('moment');
  4.  
  5. module.exports = function(context, cb) {
  6.   const today = moment();
  7.   const birthday = moment('10-07-2017');
  8.  
  9.   let data = {
  10.     about: 'Louie',
  11.     birthday: birthday.format('MM-DD-YYYY'),
  12.     days: today.diff(birthday, 'days'),
  13.     weeks: today.diff(birthday, 'weeks'),
  14.     months: today.diff(birthday, 'months'),
  15.     years: today.diff(birthday, 'years')
  16.   };
  17.  
  18.   data.stage = selectStage(data);
  19.  
  20.   cb(null, data);
  21. };
  22.  
  23. function selectStage(data) {
  24.   if (data.days <= 13) return stages['1'];
  25.   if (data.days <= 21) return stages['2'];
  26.   if (data.days <= 49) return stages['3'];
  27.   if (data.weeks <= 12) return stages['4'];
  28.   if (data.weeks <= 16) return stages['5'];
  29.   if (data.months <= 8) return stages['6'];
  30.   if (data.months <= 14) return stages['7'];
  31.   return stages['8'];
  32. }
  33.  
  34. const stages = {
  35.   '1': {
  36.     name: 'Neonatal Period',
  37.     range: 'Birth to 13 days of age',
  38.     description: 'This period is considered to be the most helpless stage of development as Louie is still not capable of regulating his own body temperature. Louie needs food and warmth from his mother or his surrogate. During this time, human interaction has to start. Louie need to be handled gently beginning this point of his development.'
  39.   },
  40.   '2': {
  41.     name: 'Transition Period',
  42.     range: '13 to 21 days of age',
  43.     description: 'Here, you will observe Louie\'s eyes and ears start to open up. Apparently, during this stage, Louie will begin to see and hear. Even his sense of taste and smell will start to develop. More handling from humans is of great significance at this point. If you have friendly kittens, the transition period will also be the best time to introduce them to Louie.'
  44.   },
  45.   '3': {
  46.     name: 'Canine Socialization Period',
  47.     range: '21 to 49 days of age',
  48.     description: 'During this stage, Louie will start to show his unique personality. This period will be a critical time for him to continue on relating with his mother and his siblings. You will see how Louie will learn to submit to his mother and to understand discipline. It is important that you do not remove him from his mama at this point in time as he could become noisy, rowdy, or worse, aggressive as he matures. In addition to that, this stage includes a brief sub-period that lasts from 21 to 23 days. It is called the Awareness period which highlights the rapid sensory development experience of the pup, thereby implying that owners have to avoid making radical changes during this phase.'
  49.   },
  50.   '4': {
  51.     name: 'Human Socialization Period',
  52.     range: '7 to 12 weeks of age',
  53.     description: 'This is the minimum age in which most puppies should be adopted out, or leave their dog mom and litter mates. Weening will be completed in this stage and Louie will be hearty enough to thrive without his mother’s milk. This stage of development includes a sub-period that happens while he is about 8 to 10 weeks. It is known as the Fear Impact Sub-period and this is when any traumatic experience could later become a lifelong problem. If Louie, for instance, experiences a fear of strangers during this point in time, it could become an issue all throughout his life.'
  54.   },
  55.   '5': {
  56.     name: 'Seniority Classification Period',
  57.     range: '12 to 16 weeks of age',
  58.     description: 'For this phase, Louie will try to figure out who is the boss. It is important that you discourage all the biting and nipping of human hands or clothing and leashes. If Louie is still with his other litter mates, intense competition among them may be noticed. By approximately 16 weeks, Louie’s personality as well as emotional makeup will be fully developed.'
  59.   },
  60.   '6': {
  61.     name: 'Flight Instinct Period',
  62.     range: '4 to 8 months of age',
  63.     description: 'During this short period, Louie will try your patience. You will observe how he will refuse to listen and try to run away and not come even when called. What you can do best is to simply wait him out and then keep him on a leash till this period goes by.'
  64.   },
  65.   '7': {
  66.     name: 'Second Fear Impact Period',
  67.     range: '6 to 14 months of age',
  68.     description: 'Louie is basically a wild teenager during this phase. Expect unpredictable behavioral changes at any given moment (just like human teens!). He may develop strange fears and may act out for no apparent reason. You’ll need extreme patience during this stage. But, when he acts out or displays unusual new fears, it’s best to ignore his wacky behavior. Never reinforce his fears by petting or praising him as this will teach him that it’s alright to be afraid.'
  69.   },
  70.   '8': {
  71.     name: 'Young Adulthood',
  72.     range: '18 to 24 month of age',
  73.     description: 'You survived puppyhood! During this time of development, Louie may try to show dominance or territorial aggression. Don’t be surprised if some sort of teenage weirdness is exhibited occasionally – just as before, ignore those brief moments, they too shall pass.'
  74.   },
  75. };
RAW Paste Data
Top