react-localize
Advanced tools
Comparing version 4.0.0-alpha.3 to 4.0.0-alpha.4
@@ -342,2 +342,3 @@ (function (global, factory) { | ||
function format(fmt) { | ||
fmt = String(fmt); // this is closer to util.format() behavior | ||
var re = /(%?)(%([jds]))/g, | ||
@@ -344,0 +345,0 @@ args = Array.prototype.slice.call(arguments, 1); |
@@ -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.ReactLocalize={},e.React,e.PropTypes)}(this,function(e,d,r){"use strict";d=d&&d.hasOwnProperty("default")?d.default:d,r=r&&r.hasOwnProperty("default")?r.default:r;var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var i="__global_unique_id__",u=function(){return t[i]=(t[i]||0)+1};function a(e){return function(){return e}}var c=function(){};c.thatReturns=a,c.thatReturnsFalse=a(!1),c.thatReturnsTrue=a(!0),c.thatReturnsNull=a(null),c.thatReturnsThis=function(){return this},c.thatReturnsArgument=function(e){return e};var h=c,l=o(function(e,t){t.__esModule=!0;n(d);var a=n(r),c=n(u);n(h);function n(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(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 s(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 p=1073741823;t.default=function(e,u){var t,n,r="__create-react-context-"+(0,c.default)()+"__",o=function(a){function c(){var e,t,n,r;l(this,c);for(var o=arguments.length,i=Array(o),u=0;u<o;u++)i[u]=arguments[u];return(e=t=f(this,a.call.apply(a,[this].concat(i)))).emitter=(n=t.props.value,r=[],{on:function(e){r.push(e)},off:function(t){r=r.filter(function(e){return e!==t})},get:function(){return n},set:function(e,t){n=e,r.forEach(function(e){return e(n,t)})}}),f(t,e)}return s(c,a),c.prototype.getChildContext=function(){var e;return(e={})[r]=this.emitter,e},c.prototype.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var t=this.props.value,n=e.value,r=void 0;((o=t)===(i=n)?0!==o||1/o==1/i:o!=o&&i!=i)?r=0:(r="function"==typeof u?u(t,n):p,0!=(r|=0)&&this.emitter.set(e.value,r))}var o,i},c.prototype.render=function(){return this.props.children},c}(d.Component);o.childContextTypes=((t={})[r]=a.default.object.isRequired,t);var i=function(i){function u(){var e,n;l(this,u);for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n=f(this,i.call.apply(i,[this].concat(r)))).state={value:n.getValue()},n.onUpdate=function(e,t){0!=((0|n.observedBits)&t)&&n.setState({value:n.getValue()})},f(n,e)}return s(u,i),u.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?p:t},u.prototype.componentDidMount=function(){this.context[r]&&this.context[r].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?p:e},u.prototype.componentWillUnmount=function(){this.context[r]&&this.context[r].off(this.onUpdate)},u.prototype.getValue=function(){return this.context[r]?this.context[r].get():e},u.prototype.render=function(){return(Array.isArray(e=this.props.children)?e[0]:e)(this.state.value);var e},u}(d.Component);return i.contextTypes=((n={})[r]=a.default.object,n),{Provider:o,Consumer:i}},e.exports=t.default});n(l);var f=n(o(function(e,t){t.__esModule=!0;var n=o(d),r=o(l);function o(e){return e&&e.__esModule?e:{default:e}}t.default=n.default.createContext||r.default,e.exports=t.default}));function s(e){var i=Array.prototype.slice.call(arguments,1);return i.length&&(e=e.replace(/(%?)(%([jds]))/g,function(e,t,n,r){var o=i.shift();switch(r){case"s":o=""+o;break;case"d":o=+o;break;case"j":o=JSON.stringify(o)}return t?(i.unshift(o),e):o})),i.length&&(e+=" "+i.join(" ")),""+(e=e.replace(/%{2,2}/g,"%"))}var p=function(){function r(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(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),y=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},v=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},b=f({localize:function(e){return e},debug:!0,xLocale:!1}),_=function(e){function u(){var e,t,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=i=v(this,(e=u.__proto__||Object.getPrototypeOf(u)).call.apply(e,[this].concat(r))))._localize=function(e,t){var n=i.props,r=n.localize;if(n.xLocale)return"XXXXXX";var o=r;return"function"!=typeof r&&(o=function(e,t){return debug&&console.warn("Unable to localize "+t+", not connected to react-localize"),t}),o(n.messages,e,t)},v(i,t)}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)}(u,d.Component),p(u,[{key:"render",value:function(){return d.createElement(b.Provider,{value:{localize:this._localize}},this.props.children)}}]),u}();_.defaultProps={debug:!1,localize:function(e,t,n){return n?s(e[t],n):s(e[t])},xLocale:!1};var g=b.Consumer;e.LocalizationProvider=_,e.LocalizationConsumer=g,e.withLocalization=function(n){var e=function(t){return d.createElement(g,null,function(e){return d.createElement(n,y({},t,{localize:e.localize}))})};return e.displayName="withLocalization("+n.name+")",e},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.ReactLocalize={},e.React,e.PropTypes)}(this,function(e,d,r){"use strict";d=d&&d.hasOwnProperty("default")?d.default:d,r=r&&r.hasOwnProperty("default")?r.default:r;var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var i="__global_unique_id__",u=function(){return t[i]=(t[i]||0)+1};function a(e){return function(){return e}}var c=function(){};c.thatReturns=a,c.thatReturnsFalse=a(!1),c.thatReturnsTrue=a(!0),c.thatReturnsNull=a(null),c.thatReturnsThis=function(){return this},c.thatReturnsArgument=function(e){return e};var h=c,l=o(function(e,t){t.__esModule=!0;n(d);var a=n(r),c=n(u);n(h);function n(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(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 s(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 p=1073741823;t.default=function(e,u){var t,n,r="__create-react-context-"+(0,c.default)()+"__",o=function(a){function c(){var e,t,n,r;l(this,c);for(var o=arguments.length,i=Array(o),u=0;u<o;u++)i[u]=arguments[u];return(e=t=f(this,a.call.apply(a,[this].concat(i)))).emitter=(n=t.props.value,r=[],{on:function(e){r.push(e)},off:function(t){r=r.filter(function(e){return e!==t})},get:function(){return n},set:function(e,t){n=e,r.forEach(function(e){return e(n,t)})}}),f(t,e)}return s(c,a),c.prototype.getChildContext=function(){var e;return(e={})[r]=this.emitter,e},c.prototype.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var t=this.props.value,n=e.value,r=void 0;((o=t)===(i=n)?0!==o||1/o==1/i:o!=o&&i!=i)?r=0:(r="function"==typeof u?u(t,n):p,0!=(r|=0)&&this.emitter.set(e.value,r))}var o,i},c.prototype.render=function(){return this.props.children},c}(d.Component);o.childContextTypes=((t={})[r]=a.default.object.isRequired,t);var i=function(i){function u(){var e,n;l(this,u);for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n=f(this,i.call.apply(i,[this].concat(r)))).state={value:n.getValue()},n.onUpdate=function(e,t){0!=((0|n.observedBits)&t)&&n.setState({value:n.getValue()})},f(n,e)}return s(u,i),u.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?p:t},u.prototype.componentDidMount=function(){this.context[r]&&this.context[r].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?p:e},u.prototype.componentWillUnmount=function(){this.context[r]&&this.context[r].off(this.onUpdate)},u.prototype.getValue=function(){return this.context[r]?this.context[r].get():e},u.prototype.render=function(){return(Array.isArray(e=this.props.children)?e[0]:e)(this.state.value);var e},u}(d.Component);return i.contextTypes=((n={})[r]=a.default.object,n),{Provider:o,Consumer:i}},e.exports=t.default});n(l);var f=n(o(function(e,t){t.__esModule=!0;var n=o(d),r=o(l);function o(e){return e&&e.__esModule?e:{default:e}}t.default=n.default.createContext||r.default,e.exports=t.default}));function s(e){e+="";var i=Array.prototype.slice.call(arguments,1);return i.length&&(e=e.replace(/(%?)(%([jds]))/g,function(e,t,n,r){var o=i.shift();switch(r){case"s":o=""+o;break;case"d":o=+o;break;case"j":o=JSON.stringify(o)}return t?(i.unshift(o),e):o})),i.length&&(e+=" "+i.join(" ")),""+(e=e.replace(/%{2,2}/g,"%"))}var p=function(){function r(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(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),y=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},v=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},b=f({localize:function(e){return e},debug:!0,xLocale:!1}),_=function(e){function u(){var e,t,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=i=v(this,(e=u.__proto__||Object.getPrototypeOf(u)).call.apply(e,[this].concat(r))))._localize=function(e,t){var n=i.props,r=n.localize;if(n.xLocale)return"XXXXXX";var o=r;return"function"!=typeof r&&(o=function(e,t){return debug&&console.warn("Unable to localize "+t+", not connected to react-localize"),t}),o(n.messages,e,t)},v(i,t)}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)}(u,d.Component),p(u,[{key:"render",value:function(){return d.createElement(b.Provider,{value:{localize:this._localize}},this.props.children)}}]),u}();_.defaultProps={debug:!1,localize:function(e,t,n){return n?s(e[t],n):s(e[t])},xLocale:!1};var g=b.Consumer;e.LocalizationProvider=_,e.LocalizationConsumer=g,e.withLocalization=function(n){var e=function(t){return d.createElement(g,null,function(e){return d.createElement(n,y({},t,{localize:e.localize}))})};return e.displayName="withLocalization("+n.name+")",e},Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -7,2 +7,3 @@ // I used to use `util.format()` which was massive, then I switched to | ||
function format(fmt) { | ||
fmt = String(fmt); // this is closer to util.format() behavior | ||
var re = /(%?)(%([jds]))/g, | ||
@@ -9,0 +10,0 @@ args = Array.prototype.slice.call(arguments, 1); |
@@ -10,2 +10,3 @@ 'use strict'; | ||
function format(fmt) { | ||
fmt = String(fmt); // this is closer to util.format() behavior | ||
var re = /(%?)(%([jds]))/g, | ||
@@ -12,0 +13,0 @@ args = Array.prototype.slice.call(arguments, 1); |
{ | ||
"name": "react-localize", | ||
"version": "4.0.0-alpha.3", | ||
"version": "4.0.0-alpha.4", | ||
"description": "A simple context wrapper and text localization component for localizing strings", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
45274
706
0