UNPKG

react-period-of-stay-input

Version:

React.js component for entering a period of stay in a hotel: check-in + check-out date

1 lines 5.37 kB
{"id":"4NrO","dependencies":[{"name":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/package.json","includedInParent":true,"mtime":1533713806935},{"name":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/package.json","includedInParent":true,"mtime":1534170011202},{"name":"intl-messageformat","loc":{"line":10,"column":35},"parent":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/core.js","resolved":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-messageformat/index.js"},{"name":"./diff","loc":{"line":10,"column":79},"parent":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/core.js","resolved":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/diff.js"},{"name":"./es5","loc":{"line":10,"column":110},"parent":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/core.js","resolved":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/es5.js"}],"generated":{"js":"\"use strict\";var e=require(\"intl-messageformat\"),t=require(\"./diff\"),r=require(\"./es5\");exports.default=i;var o=[\"second\",\"second-short\",\"minute\",\"minute-short\",\"hour\",\"hour-short\",\"day\",\"day-short\",\"month\",\"month-short\",\"year\",\"year-short\"],a=[\"best fit\",\"numeric\"];function i(e,t){t=t||{},r.isArray(e)&&(e=e.concat()),r.defineProperty(this,\"_locale\",{value:this._resolveLocale(e)}),r.defineProperty(this,\"_options\",{value:{style:this._resolveStyle(t.style),units:this._isValidUnits(t.units)&&t.units}}),r.defineProperty(this,\"_locales\",{value:e}),r.defineProperty(this,\"_fields\",{value:this._findFields(this._locale)}),r.defineProperty(this,\"_messages\",{value:r.objCreate(null)});var o=this;this.format=function(e,t){return o._format(e,t)}}r.defineProperty(i,\"__localeData__\",{value:r.objCreate(null)}),r.defineProperty(i,\"__addLocaleData\",{value:function(t){if(!t||!t.locale)throw new Error(\"Locale data provided to IntlRelativeFormat is missing a `locale` property value\");i.__localeData__[t.locale.toLowerCase()]=t,e.default.__addLocaleData(t)}}),r.defineProperty(i,\"defaultLocale\",{enumerable:!0,writable:!0,value:void 0}),r.defineProperty(i,\"thresholds\",{enumerable:!0,value:{second:45,\"second-short\":45,minute:45,\"minute-short\":45,hour:22,\"hour-short\":22,day:26,\"day-short\":26,month:11,\"month-short\":11}}),i.prototype.resolvedOptions=function(){return{locale:this._locale,style:this._options.style,units:this._options.units}},i.prototype._compileMessage=function(t){var r,o=this._locales,a=(this._locale,this._fields[t].relativeTime),i=\"\",n=\"\";for(r in a.future)a.future.hasOwnProperty(r)&&(i+=\" \"+r+\" {\"+a.future[r].replace(\"{0}\",\"#\")+\"}\");for(r in a.past)a.past.hasOwnProperty(r)&&(n+=\" \"+r+\" {\"+a.past[r].replace(\"{0}\",\"#\")+\"}\");var s=\"{when, select, future {{0, plural, \"+i+\"}}past {{0, plural, \"+n+\"}}}\";return new e.default(s,o)},i.prototype._getMessage=function(e){var t=this._messages;return t[e]||(t[e]=this._compileMessage(e)),t[e]},i.prototype._getRelativeUnits=function(e,t){var r=this._fields[t];if(r.relative)return r.relative[e]},i.prototype._findFields=function(e){for(var t=i.__localeData__,r=t[e.toLowerCase()];r;){if(r.fields)return r.fields;r=r.parentLocale&&t[r.parentLocale.toLowerCase()]}throw new Error(\"Locale data added to IntlRelativeFormat is missing `fields` for :\"+e)},i.prototype._format=function(e,o){var a=o&&void 0!==o.now?o.now:r.dateNow();if(void 0===e&&(e=a),!isFinite(a))throw new RangeError(\"The `now` option provided to IntlRelativeFormat#format() is not in valid range.\");if(!isFinite(e))throw new RangeError(\"The date value provided to IntlRelativeFormat#format() is not in valid range.\");var i=t.default(a,e),n=this._options.units||this._selectUnits(i),s=i[n];if(\"numeric\"!==this._options.style){var l=this._getRelativeUnits(s,n);if(l)return l}return this._getMessage(n).format({0:Math.abs(s),when:s<0?\"past\":\"future\"})},i.prototype._isValidUnits=function(e){if(!e||r.arrIndexOf.call(o,e)>=0)return!0;if(\"string\"==typeof e){var t=/s$/.test(e)&&e.substr(0,e.length-1);if(t&&r.arrIndexOf.call(o,t)>=0)throw new Error('\"'+e+'\" is not a valid IntlRelativeFormat `units` value, did you mean: '+t)}throw new Error('\"'+e+'\" is not a valid IntlRelativeFormat `units` value, it must be one of: \"'+o.join('\", \"')+'\"')},i.prototype._resolveLocale=function(e){\"string\"==typeof e&&(e=[e]),e=(e||[]).concat(i.defaultLocale);var t,r,o,a,n=i.__localeData__;for(t=0,r=e.length;t<r;t+=1)for(o=e[t].toLowerCase().split(\"-\");o.length;){if(a=n[o.join(\"-\")])return a.locale;o.pop()}var s=e.pop();throw new Error(\"No locale data has been added to IntlRelativeFormat for: \"+e.join(\", \")+\", or the default locale: \"+s)},i.prototype._resolveStyle=function(e){if(!e)return a[0];if(r.arrIndexOf.call(a,e)>=0)return e;throw new Error('\"'+e+'\" is not a valid IntlRelativeFormat `style` value, it must be one of: \"'+a.join('\", \"')+'\"')},i.prototype._selectUnits=function(e){var t,r,a,n=o.filter(function(e){return e.indexOf(\"-short\")<1});for(t=0,r=n.length;t<r&&(a=n[t],!(Math.abs(e[a])<i.thresholds[a]));t+=1);return a};","map":null},"hash":"f79965991df48a49ae4bc167f9e20963","cacheData":{"env":{}}}