Socket
Socket
Sign inDemoInstall

pseudolocale

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pseudolocale - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

component.json
{
"name": "pseudolocale",
"version": "1.1.0",
"version": "1.2.0",
"main": "./pseudolocale.js"
}
{
"name": "pseudolocale",
"version": "1.1.0",
"version": "1.2.0",
"description": "Simple pseudolocale (psuedolocalization) for strings",

@@ -9,3 +9,3 @@ "keywords": [

],
"author": "BunKat <bill@bunkat.com>, Martin Cerny <cerny.mrtn@gmail.com",
"author": "Martin Cerny <cerny.mrtn@gmail.com",
"repository": {

@@ -16,9 +16,2 @@ "type": "git",

"main": "index.js",
"browserify": "index-browserify.js",
"jam": {
"main": "psuedoloc.js",
"shim": {
"exports": "pseudolocale"
}
},
"dependencies": {

@@ -28,8 +21,6 @@ "commander": "*"

"devDependencies": {
"smash": "~0.0.8",
"mocha": "*",
"should": ">=0.6.3",
"jslint": "*",
"uglify-js": "*",
"benchmark": "*"
"uglify-js": "*"
},

@@ -36,0 +27,0 @@ "license": "MIT",

pseudolocale = function() {
var pseudolocale = {
version: "1.1.0"
version: "1.2.0"
};

@@ -5,0 +5,0 @@ pseudolocale.option = {};

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

pseudolocale=function(){var S={version:"1.1.0",option:{},reset:function(){S.option={prepend:"[!!",append:"!!]",delimiter:"%",startDelimiter:"",endDelimiter:"",extend:0,override:void 0}}};return S.reset(),S.table={A:String.fromCharCode(192),a:String.fromCharCode(224),B:String.fromCharCode(223),b:String.fromCharCode(384),C:String.fromCharCode(262),c:String.fromCharCode(263),D:String.fromCharCode(270),d:String.fromCharCode(271),E:String.fromCharCode(274),e:String.fromCharCode(275),F:String.fromCharCode(401),f:String.fromCharCode(402),G:String.fromCharCode(284),g:String.fromCharCode(285),H:String.fromCharCode(292),h:String.fromCharCode(293),I:String.fromCharCode(296),i:String.fromCharCode(297),J:String.fromCharCode(309),j:String.fromCharCode(308),K:String.fromCharCode(310),k:String.fromCharCode(311),L:String.fromCharCode(313),l:String.fromCharCode(314),N:String.fromCharCode(323),n:String.fromCharCode(324),O:String.fromCharCode(332),o:String.fromCharCode(333),P:String.fromCharCode(420),p:String.fromCharCode(421),Q:String.fromCharCode(490),q:String.fromCharCode(491),R:String.fromCharCode(340),r:String.fromCharCode(341),S:String.fromCharCode(346),s:String.fromCharCode(347),T:String.fromCharCode(354),t:String.fromCharCode(355),U:String.fromCharCode(360),u:String.fromCharCode(361),W:String.fromCharCode(372),w:String.fromCharCode(373),Y:String.fromCharCode(374),y:String.fromCharCode(375),Z:String.fromCharCode(377),z:String.fromCharCode(378)},S.escapeRegExp=function(r){return r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},S.pad=function(r,o){for(var e=Math.floor(r.length*o/2),C=e,t=r;0<e--;)t=" "+t;for(;0<C--;)t+=" ";return t},S.str=function(r){for(var o,e,C,t=S.option,n=S.escapeRegExp(t.startDelimiter||t.delimiter),i=S.escapeRegExp(t.endDelimiter||t.delimiter),d=new RegExp(n+".*?"+i,"g"),a=[],f=0,g=0,h="";o=d.exec(r);)a.push(o);for(var m=a[g++]||{index:-1};f<r.length;)if(m.index!==f){if(e=void 0!==t.override?t.override:r[f],C=S.table[e])e=C[r.length%C.length];h+=e,f++}else h+=m[0],f+=m[0].length,m=a[g++]||{index:-1};return t.prepend+S.pad(h,t.extend)+t.append},S}();
pseudolocale=function(){var pseudolocale={version:"1.2.0",option:{},reset:function(){pseudolocale.option={prepend:"[!!",append:"!!]",delimiter:"%",startDelimiter:"",endDelimiter:"",extend:0,override:void 0}}};return pseudolocale.reset(),pseudolocale.table={A:String.fromCharCode(192),a:String.fromCharCode(224),B:String.fromCharCode(223),b:String.fromCharCode(384),C:String.fromCharCode(262),c:String.fromCharCode(263),D:String.fromCharCode(270),d:String.fromCharCode(271),E:String.fromCharCode(274),e:String.fromCharCode(275),F:String.fromCharCode(401),f:String.fromCharCode(402),G:String.fromCharCode(284),g:String.fromCharCode(285),H:String.fromCharCode(292),h:String.fromCharCode(293),I:String.fromCharCode(296),i:String.fromCharCode(297),J:String.fromCharCode(309),j:String.fromCharCode(308),K:String.fromCharCode(310),k:String.fromCharCode(311),L:String.fromCharCode(313),l:String.fromCharCode(314),N:String.fromCharCode(323),n:String.fromCharCode(324),O:String.fromCharCode(332),o:String.fromCharCode(333),P:String.fromCharCode(420),p:String.fromCharCode(421),Q:String.fromCharCode(490),q:String.fromCharCode(491),R:String.fromCharCode(340),r:String.fromCharCode(341),S:String.fromCharCode(346),s:String.fromCharCode(347),T:String.fromCharCode(354),t:String.fromCharCode(355),U:String.fromCharCode(360),u:String.fromCharCode(361),W:String.fromCharCode(372),w:String.fromCharCode(373),Y:String.fromCharCode(374),y:String.fromCharCode(375),Z:String.fromCharCode(377),z:String.fromCharCode(378)},pseudolocale.escapeRegExp=function(str){return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},pseudolocale.pad=function(str,percent){for(var lenLeft=Math.floor(str.length*percent/2),lenRight=lenLeft,pStr=str;0<lenLeft--;)pStr=" "+pStr;for(;0<lenRight--;)pStr+=" ";return pStr},pseudolocale.str=function(str){for(var m,c,pc,opts=pseudolocale.option,startdelim=pseudolocale.escapeRegExp(opts.startDelimiter||opts.delimiter),enddelim=pseudolocale.escapeRegExp(opts.endDelimiter||opts.delimiter),re=new RegExp(startdelim+".*?"+enddelim,"g"),tokens=[],i=0,tokenIdx=0,result="";m=re.exec(str);)tokens.push(m);for(var token=tokens[tokenIdx++]||{index:-1};i<str.length;)if(token.index!==i){if(c=void 0!==opts.override?opts.override:str[i],pc=pseudolocale.table[c])c=pc[str.length%pc.length];result+=c,i++}else result+=token[0],i+=token[0].length,token=tokens[tokenIdx++]||{index:-1};return opts.prepend+pseudolocale.pad(result,opts.extend)+opts.append},pseudolocale}();

@@ -1,10 +0,5 @@

# Pseudolocale v1.0.0
# Pseudolocale
_Pseudolocale_ is a small library for quickly pseudolocalizing strings. [Pseudolocalization](http://en.wikipedia.org/wiki/Pseudolocalealization) is a method for testing the internationalization aspects of your application by replacing your strings with altered versions that maintains string readability while including the most problematic characteristics including text length and character length. It also makes hard coded strings and improperly concatenated strings easy to spot so that they can be properly localized.
## Difference to Pseudoloc
- This library is idempotent. The function returns same result every time it is run.
- Delimiter could be Regex special character. Original library did not support these special characters.
## Using with Node.js

@@ -27,9 +22,2 @@

## Using with webpack/browserify
var pseudolocale = require('pseudolocale/index-browserify');
pseudolocale.str('A test string with a %token%.')
// [!!Á ţȇšŧ śťřīņğ ŵıţħ ą %token%.!!]
## Using from the command line

@@ -144,2 +132,2 @@

$ make benchmark
$ make benchmark

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

/**
* Option.js
*
* Pseudolocalealization options.
*
* (c) 2013 Bill, BunKat LLC.
* Pseudolocale is freely distributable under the MIT license.
* For all details and documentation:
* http://bunkat.github.com/pseudolocale
*/
pseudolocale.option = {};

@@ -12,0 +2,0 @@

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

/**
* Pad.js
*
* Pads a string with additional characters.
*
* (c) 2013 Bill, BunKat LLC.
* Pseudolocale is freely distributable under the MIT license.
* For all details and documentation:
* http://bunkat.github.com/pseudolocale
*/
pseudolocale.pad = function (str, percent) {

@@ -12,0 +2,0 @@

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

/**
* Str.js
*
* Replaces all characters in str with pseudolocalized version according to
* pseudolocale.options.
*
* (c) 2013 Bill, BunKat LLC.
* Pseudolocale is freely distributable under the MIT license.
* For all details and documentation:
* http://bunkat.github.com/pseudolocale
*/
pseudolocale.str = function(str) {

@@ -13,0 +2,0 @@ var opts = pseudolocale.option

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

/**
* Table.js
*
* Character replacement table.
*
* (c) 2013 Bill, BunKat LLC.
* Pseudolocale is freely distributable under the MIT license.
* For all details and documentation:
* http://bunkat.github.com/pseudolocale
*/
pseudolocale.table = {

@@ -12,0 +2,0 @@ A: String.fromCharCode(192),

@@ -1,9 +0,2 @@

/**
* pseudolocale.js
* (c) 2013 Bill, BunKat LLC.
* Pseudolocale is freely distributable under the MIT license.
* For all details and documentation:
* http://bunkat.github.com/pseudolocale
*/
pseudolocale = (function() {
var pseudolocale = {version: "1.1.0"}; // semver
var pseudolocale = {version: "1.2.0"}; // semver
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