New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lib-pintl

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lib-pintl - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

3

dist/esm/core.js

@@ -143,3 +143,4 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

}
result = result.replace(entrance, toInsert);
result = result.replace(new RegExp(entrance, 'g'), toInsert);
}

@@ -146,0 +147,0 @@ });

@@ -5,3 +5,3 @@

* Copyright 2018-2019, Pentatonica.co
* PIntl v0.1.0
* PIntl v0.2.0
*/

@@ -160,3 +160,4 @@

}
result = result.replace(entrance, toInsert);
result = result.replace(new RegExp(entrance, 'g'), toInsert);
}

@@ -163,0 +164,0 @@ });

@@ -5,3 +5,3 @@

* Copyright 2018-2019, Pentatonica.co
* PIntl v0.1.0
* PIntl v0.2.0
*/

@@ -105,3 +105,4 @@

}
result = result.replace(entrance, toInsert);
result = result.replace(new RegExp(entrance, 'g'), toInsert);
}

@@ -108,0 +109,0 @@ });

@@ -1,1 +0,1 @@

import{Component}from"react";import PropTypes from"prop-types";var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function getObjectKey(e,t){var r=t.split("."),n=e,o=!0,i=!1,a=void 0;try{for(var l,u=r[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var c=l.value;if(!n)return"";n=n[c]}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return n}function pickContextArgument(e,t){var r=function(e){return e},n="";switch(!0){case"string"==typeof t:r=function(e){return e===t};break;case"number"==typeof t:r=function(e){var r=/(\d+)..(\d+)/.exec(e),n=/(-?\d+)(\+|-)/.exec(e);return e==t||null!==r&&r[1]<=t&&r[2]>=t||null!==n&&("+"===n[2]?t>=n[1]:t<=n[1])}}var o=!0,i=!1,a=void 0;try{for(var l,u=Object.keys(e)[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var c=l.value;if(r(c)){n=e[c];break}}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return!n&&e._&&(n=e._),n}function pickContext(e,t){var r={};return Object.keys(e).forEach(function(n){var o=e[n];"object"===(void 0===o?"undefined":_typeof(o))?r[n]=pickContextArgument(o,t):r[n]=o}),r}function prepareTextMessage(e,t){if(void 0===t)return e;var r=e;if("object"!==(void 0===t?"undefined":_typeof(t)))return r.replace("{arg}",t);var n=String(r).match(/{\w+}(?!\\)/g),o=[];return n&&n.forEach(function(e){if(-1===o.indexOf(e)){o.push(e);var n=prepareTextMessage(t[/\w+/.exec(e)[0]],t);"string"!=typeof n||n||(n=""),r=r.replace(e,n)}}),r}function getText(e,t,r,n,o){if(t)return o?"{{"+r+"."+o+"}}":"{{"+r+"}}";var i=getObjectKey(e,r);if(i){if("object"===(void 0===i?"undefined":_typeof(i))){var a=pickContext(i,o);if(i.message){var l=_extends({},a,n,{context:o});return prepareTextMessage(i.message,l)}return prepareTextMessage(pickContextArgument(i,o),_extends({},n,{context:o}))}return prepareTextMessage(i,n)}return""}function getName(e,t,r){return-1!==["uk","ru"].indexOf(e)?(r+" "+t).trim():(t+" "+r).trim()}function getDate(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},n=t;if("string"==typeof t){if(!t)return"";n=new Date(t)}return new Intl.DateTimeFormat(e,r).format(n)}var core=Object.freeze({getText:getText,getName:getName,getDate:getDate}),_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var IntlWrapper=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,Component),_createClass(t,[{key:"getChildContext",value:function(){return{intl:{getText:getText.bind(null,this.props.messages,this.props.inShell),getName:getName.bind(null,this.props.lang),getDate:getDate.bind(null,this.props.lang),lang:this.props.lang}}}},{key:"render",value:function(){return this.props.children}}]),t}();IntlWrapper.propTypes={children:PropTypes.oneOfType([PropTypes.node,PropTypes.object]),lang:PropTypes.string,messages:PropTypes.object,inShell:PropTypes.bool},IntlWrapper.defaultProps={children:null,lang:"en",messages:{},inShell:!1},IntlWrapper.childContextTypes={intl:PropTypes.object};var ATTRIBUTE_NAME="data-localization-id",ARG_NAME="data-localization-arg";function getTranslatableChildren(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;return e?e.querySelectorAll("*["+ATTRIBUTE_NAME+"]"):[]}function getElementAttributes(e){return e instanceof HTMLElement?{id:e.getAttribute(ATTRIBUTE_NAME),arg:e.getAttribute(ARG_NAME)}:{}}function getChildElementCount(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,r=0;r<e.childNodes.length;r+=1)t+=1===e.nodeType?1:0;return t}function translateElement(e,t){var r=getElementAttributes(t);if(!r.id)return!1;var n=getText(e,!1,r.id);if(r.arg)return t.setAttribute(r.arg,n),!1;var o=document.createTextNode(n);return 0===getChildElementCount(t)?t.firstChild?t.replaceChild(o,t.firstChild):t.appendChild(o):t.insertBefore(o,t.firstChild),!0}function translateFragment(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement,r=getTranslatableChildren(t),n=r.length,o=0;o<n;o+=1)translateElement(e,r[o]);translateElement(e,t)}var dom=Object.freeze({translateFragment:translateFragment});export{core as IntlCore,dom as IntlDOM,IntlWrapper};
import{Component}from"react";import PropTypes from"prop-types";var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function getObjectKey(e,t){var r=t.split("."),n=e,o=!0,i=!1,a=void 0;try{for(var l,u=r[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var c=l.value;if(!n)return"";n=n[c]}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return n}function pickContextArgument(e,t){var r=function(e){return e},n="";switch(!0){case"string"==typeof t:r=function(e){return e===t};break;case"number"==typeof t:r=function(e){var r=/(\d+)..(\d+)/.exec(e),n=/(-?\d+)(\+|-)/.exec(e);return e==t||null!==r&&r[1]<=t&&r[2]>=t||null!==n&&("+"===n[2]?t>=n[1]:t<=n[1])}}var o=!0,i=!1,a=void 0;try{for(var l,u=Object.keys(e)[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var c=l.value;if(r(c)){n=e[c];break}}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return!n&&e._&&(n=e._),n}function pickContext(e,t){var r={};return Object.keys(e).forEach(function(n){var o=e[n];"object"===(void 0===o?"undefined":_typeof(o))?r[n]=pickContextArgument(o,t):r[n]=o}),r}function prepareTextMessage(e,t){if(void 0===t)return e;var r=e;if("object"!==(void 0===t?"undefined":_typeof(t)))return r.replace("{arg}",t);var n=String(r).match(/{\w+}(?!\\)/g),o=[];return n&&n.forEach(function(e){if(-1===o.indexOf(e)){o.push(e);var n=prepareTextMessage(t[/\w+/.exec(e)[0]],t);"string"!=typeof n||n||(n=""),r=r.replace(new RegExp(e,"g"),n)}}),r}function getText(e,t,r,n,o){if(t)return o?"{{"+r+"."+o+"}}":"{{"+r+"}}";var i=getObjectKey(e,r);if(i){if("object"===(void 0===i?"undefined":_typeof(i))){var a=pickContext(i,o);if(i.message){var l=_extends({},a,n,{context:o});return prepareTextMessage(i.message,l)}return prepareTextMessage(pickContextArgument(i,o),_extends({},n,{context:o}))}return prepareTextMessage(i,n)}return""}function getName(e,t,r){return-1!==["uk","ru"].indexOf(e)?(r+" "+t).trim():(t+" "+r).trim()}function getDate(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},n=t;if("string"==typeof t){if(!t)return"";n=new Date(t)}return new Intl.DateTimeFormat(e,r).format(n)}var core=Object.freeze({getText:getText,getName:getName,getDate:getDate}),_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var IntlWrapper=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,Component),_createClass(t,[{key:"getChildContext",value:function(){return{intl:{getText:getText.bind(null,this.props.messages,this.props.inShell),getName:getName.bind(null,this.props.lang),getDate:getDate.bind(null,this.props.lang),lang:this.props.lang}}}},{key:"render",value:function(){return this.props.children}}]),t}();IntlWrapper.propTypes={children:PropTypes.oneOfType([PropTypes.node,PropTypes.object]),lang:PropTypes.string,messages:PropTypes.object,inShell:PropTypes.bool},IntlWrapper.defaultProps={children:null,lang:"en",messages:{},inShell:!1},IntlWrapper.childContextTypes={intl:PropTypes.object};var ATTRIBUTE_NAME="data-localization-id",ARG_NAME="data-localization-arg";function getTranslatableChildren(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;return e?e.querySelectorAll("*["+ATTRIBUTE_NAME+"]"):[]}function getElementAttributes(e){return e instanceof HTMLElement?{id:e.getAttribute(ATTRIBUTE_NAME),arg:e.getAttribute(ARG_NAME)}:{}}function getChildElementCount(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,r=0;r<e.childNodes.length;r+=1)t+=1===e.nodeType?1:0;return t}function translateElement(e,t){var r=getElementAttributes(t);if(!r.id)return!1;var n=getText(e,!1,r.id);if(r.arg)return t.setAttribute(r.arg,n),!1;var o=document.createTextNode(n);return 0===getChildElementCount(t)?t.firstChild?t.replaceChild(o,t.firstChild):t.appendChild(o):t.insertBefore(o,t.firstChild),!0}function translateFragment(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement,r=getTranslatableChildren(t),n=r.length,o=0;o<n;o+=1)translateElement(e,r[o]);translateElement(e,t)}var dom=Object.freeze({translateFragment:translateFragment});export{core as IntlCore,dom as IntlDOM,IntlWrapper};

@@ -5,3 +5,3 @@

* Copyright 2018-2019, Pentatonica.co
* PIntl v0.1.0
* PIntl v0.2.0
*/

@@ -159,3 +159,4 @@

}
result = result.replace(entrance, toInsert);
result = result.replace(new RegExp(entrance, 'g'), toInsert);
}

@@ -162,0 +163,0 @@ });

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],t):t(e.PIntl={},e.React,e.PropTypes)}(this,function(e,t,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){var n=function(e){return e},r="";switch(!0){case"string"==typeof t:n=function(e){return e===t};break;case"number"==typeof t:n=function(e){var n=/(\d+)..(\d+)/.exec(e),r=/(-?\d+)(\+|-)/.exec(e);return e==t||null!==n&&n[1]<=t&&n[2]>=t||null!==r&&("+"===r[2]?t>=r[1]:t<=r[1])}}var o=!0,i=!1,u=void 0;try{for(var a,l=Object.keys(e)[Symbol.iterator]();!(o=(a=l.next()).done);o=!0){var c=a.value;if(n(c)){r=e[c];break}}}catch(e){i=!0,u=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw u}}return!r&&e._&&(r=e._),r}function u(e,t){if(void 0===t)return e;var n=e;if("object"!==(void 0===t?"undefined":o(t)))return n.replace("{arg}",t);var r=String(n).match(/{\w+}(?!\\)/g),i=[];return r&&r.forEach(function(e){if(-1===i.indexOf(e)){i.push(e);var r=u(t[/\w+/.exec(e)[0]],t);"string"!=typeof r||r||(r=""),n=n.replace(e,r)}}),n}function a(e,t,n,a,l){if(t)return l?"{{"+n+"."+l+"}}":"{{"+n+"}}";var c=function(e,t){var n=t.split("."),r=e,o=!0,i=!1,u=void 0;try{for(var a,l=n[Symbol.iterator]();!(o=(a=l.next()).done);o=!0){var c=a.value;if(!r)return"";r=r[c]}}catch(e){i=!0,u=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw u}}return r}(e,n);if(c){if("object"===(void 0===c?"undefined":o(c))){var f=function(e,t){var n={};return Object.keys(e).forEach(function(r){var u=e[r];"object"===(void 0===u?"undefined":o(u))?n[r]=i(u,t):n[r]=u}),n}(c,l);if(c.message){var s=r({},f,a,{context:l});return u(c.message,s)}return u(i(c,l),r({},a,{context:l}))}return u(c,a)}return""}function l(e,t,n){return-1!==["uk","ru"].indexOf(e)?(n+" "+t).trim():(t+" "+n).trim()}function c(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},r=t;if("string"==typeof t){if(!t)return"";r=new Date(t)}return new Intl.DateTimeFormat(e,n).format(r)}var f=Object.freeze({getText:a,getName:l,getDate:c}),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var p=function(e){function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,t.Component),s(n,[{key:"getChildContext",value:function(){return{intl:{getText:a.bind(null,this.props.messages,this.props.inShell),getName:l.bind(null,this.props.lang),getDate:c.bind(null,this.props.lang),lang:this.props.lang}}}},{key:"render",value:function(){return this.props.children}}]),n}();p.propTypes={children:n.oneOfType([n.node,n.object]),lang:n.string,messages:n.object,inShell:n.bool},p.defaultProps={children:null,lang:"en",messages:{},inShell:!1},p.childContextTypes={intl:n.object};var d="data-localization-id",y="data-localization-arg";function h(e,t){var n=function(e){return e instanceof HTMLElement?{id:e.getAttribute(d),arg:e.getAttribute(y)}:{}}(t);if(!n.id)return!1;var r=a(e,!1,n.id);if(n.arg)return t.setAttribute(n.arg,r),!1;var o=document.createTextNode(r);return 0===function(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,n=0;n<e.childNodes.length;n+=1)t+=1===e.nodeType?1:0;return t}(t)?t.firstChild?t.replaceChild(o,t.firstChild):t.appendChild(o):t.insertBefore(o,t.firstChild),!0}var v=Object.freeze({translateFragment:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;return e?e.querySelectorAll("*["+d+"]"):[]}(t),r=n.length,o=0;o<r;o+=1)h(e,n[o]);h(e,t)}});e.IntlCore=f,e.IntlDOM=v,e.IntlWrapper=p,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],t):t(e.PIntl={},e.React,e.PropTypes)}(this,function(e,t,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){var n=function(e){return e},r="";switch(!0){case"string"==typeof t:n=function(e){return e===t};break;case"number"==typeof t:n=function(e){var n=/(\d+)..(\d+)/.exec(e),r=/(-?\d+)(\+|-)/.exec(e);return e==t||null!==n&&n[1]<=t&&n[2]>=t||null!==r&&("+"===r[2]?t>=r[1]:t<=r[1])}}var o=!0,i=!1,u=void 0;try{for(var a,l=Object.keys(e)[Symbol.iterator]();!(o=(a=l.next()).done);o=!0){var c=a.value;if(n(c)){r=e[c];break}}}catch(e){i=!0,u=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw u}}return!r&&e._&&(r=e._),r}function u(e,t){if(void 0===t)return e;var n=e;if("object"!==(void 0===t?"undefined":o(t)))return n.replace("{arg}",t);var r=String(n).match(/{\w+}(?!\\)/g),i=[];return r&&r.forEach(function(e){if(-1===i.indexOf(e)){i.push(e);var r=u(t[/\w+/.exec(e)[0]],t);"string"!=typeof r||r||(r=""),n=n.replace(new RegExp(e,"g"),r)}}),n}function a(e,t,n,a,l){if(t)return l?"{{"+n+"."+l+"}}":"{{"+n+"}}";var c=function(e,t){var n=t.split("."),r=e,o=!0,i=!1,u=void 0;try{for(var a,l=n[Symbol.iterator]();!(o=(a=l.next()).done);o=!0){var c=a.value;if(!r)return"";r=r[c]}}catch(e){i=!0,u=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw u}}return r}(e,n);if(c){if("object"===(void 0===c?"undefined":o(c))){var f=function(e,t){var n={};return Object.keys(e).forEach(function(r){var u=e[r];"object"===(void 0===u?"undefined":o(u))?n[r]=i(u,t):n[r]=u}),n}(c,l);if(c.message){var p=r({},f,a,{context:l});return u(c.message,p)}return u(i(c,l),r({},a,{context:l}))}return u(c,a)}return""}function l(e,t,n){return-1!==["uk","ru"].indexOf(e)?(n+" "+t).trim():(t+" "+n).trim()}function c(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},r=t;if("string"==typeof t){if(!t)return"";r=new Date(t)}return new Intl.DateTimeFormat(e,n).format(r)}var f=Object.freeze({getText:a,getName:l,getDate:c}),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var s=function(e){function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,t.Component),p(n,[{key:"getChildContext",value:function(){return{intl:{getText:a.bind(null,this.props.messages,this.props.inShell),getName:l.bind(null,this.props.lang),getDate:c.bind(null,this.props.lang),lang:this.props.lang}}}},{key:"render",value:function(){return this.props.children}}]),n}();s.propTypes={children:n.oneOfType([n.node,n.object]),lang:n.string,messages:n.object,inShell:n.bool},s.defaultProps={children:null,lang:"en",messages:{},inShell:!1},s.childContextTypes={intl:n.object};var d="data-localization-id",y="data-localization-arg";function h(e,t){var n=function(e){return e instanceof HTMLElement?{id:e.getAttribute(d),arg:e.getAttribute(y)}:{}}(t);if(!n.id)return!1;var r=a(e,!1,n.id);if(n.arg)return t.setAttribute(n.arg,r),!1;var o=document.createTextNode(r);return 0===function(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,n=0;n<e.childNodes.length;n+=1)t+=1===e.nodeType?1:0;return t}(t)?t.firstChild?t.replaceChild(o,t.firstChild):t.appendChild(o):t.insertBefore(o,t.firstChild),!0}var v=Object.freeze({translateFragment:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;return e?e.querySelectorAll("*["+d+"]"):[]}(t),r=n.length,o=0;o<r;o+=1)h(e,n[o]);h(e,t)}});e.IntlCore=f,e.IntlDOM=v,e.IntlWrapper=s,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "lib-pintl",
"version": "0.1.0",
"version": "0.2.0",
"description": "PIntl - Library for internationalization of js applications",

@@ -5,0 +5,0 @@ "main": "./dist/index.umd.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc