Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,2 @@ | ||
/* written - v0.1.5 - MIT */ | ||
/* written - v0.1.6 - MIT */ | ||
/* Written provides a set of utilities for manipulating text, with a focus on providing typographic tools rather than pure string manipulation. */ | ||
@@ -3,0 +3,0 @@ /* https://github.com/stephenhutchings/written.git */ |
@@ -1,2 +0,2 @@ | ||
/* written - v0.1.5 - MIT */ | ||
/* written - v0.1.6 - MIT */ | ||
/* Written provides a set of utilities for manipulating text, with a focus on providing typographic tools rather than pure string manipulation. */ | ||
@@ -3,0 +3,0 @@ /* https://github.com/stephenhutchings/written.git */ |
@@ -1,2 +0,2 @@ | ||
/* written - v0.1.5 - MIT */ | ||
/* written - v0.1.6 - MIT */ | ||
/* Written provides a set of utilities for manipulating text, with a focus on providing typographic tools rather than pure string manipulation. */ | ||
@@ -3,0 +3,0 @@ /* https://github.com/stephenhutchings/written.git */ |
@@ -1,2 +0,2 @@ | ||
/* written - v0.1.5 - MIT */ | ||
/* written - v0.1.6 - MIT */ | ||
/* Written provides a set of utilities for manipulating text, with a focus on providing typographic tools rather than pure string manipulation. */ | ||
@@ -3,0 +3,0 @@ /* https://github.com/stephenhutchings/written.git */ |
@@ -1,2 +0,2 @@ | ||
/* written - v0.1.5 - MIT */ | ||
/* written - v0.1.6 - MIT */ | ||
/* Written provides a set of utilities for manipulating text, with a focus on providing typographic tools rather than pure string manipulation. */ | ||
@@ -3,0 +3,0 @@ /* https://github.com/stephenhutchings/written.git */ |
@@ -1,2 +0,2 @@ | ||
/* written - v0.1.5 - MIT */ | ||
/* written - v0.1.6 - MIT */ | ||
/* Written provides a set of utilities for manipulating text, with a focus on providing typographic tools rather than pure string manipulation. */ | ||
@@ -40,3 +40,3 @@ /* https://github.com/stephenhutchings/written.git */ | ||
} | ||
if (toString.call(regEx) !== "[object RegExp]") { | ||
if (Object.prototype.toString.call(regEx) !== "[object RegExp]") { | ||
regEx = dictionary[regEx].noncaps; | ||
@@ -43,0 +43,0 @@ } |
@@ -1,4 +0,4 @@ | ||
/* written - v0.1.5 - MIT */ | ||
/* written - v0.1.6 - MIT */ | ||
/* Written provides a set of utilities for manipulating text, with a focus on providing typographic tools rather than pure string manipulation. */ | ||
/* https://github.com/stephenhutchings/written.git */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.written=b()}(this,function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return g={EN:{noncaps:/^(an|and|as|at|be|but|by|has|in|if|nor|of|off|on|or|out|per|the|to|up|was)$/,cardinals:{written:["one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"]},ordinals:{written:["first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth"],rule:/((1{0,1}[123])|(\d))\b/,suffixes:{1:"st",2:"nd",3:"rd",n:"th"}}}},b=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},c=function(a,c){var d,e;return null==c&&(c=g.EN.noncaps),"[object RegExp]"!==toString.call(c)&&(c=g[c].noncaps),function(){var f,g,h,i;for(h=a.split(/\s/g),i=[],d=f=0,g=h.length;g>f;d=++f)e=h[d],d>0&&c.test(e)?i.push(e):i.push(b(e));return i}().join(" ")},h=function(a,b,c){return""+a+b+(c||a)},e=function(a,b){var c;return null==b&&(b=""),function(){var b,d,e;for(e=[],b=0,d=a.length;d>b;b++)c=a[b],c&&"string"==typeof c&&e.push(c);return e}().join(b)},f=function(a){return a.replace(/\s+/g," ")},d=/[-_\s]+|(!?[A-Z][a-z]*)/g,a=function(a){var c,f;return e(function(){var e,g,h,i;for(h=a.split(d),i=[],c=e=0,g=h.length;g>e;c=++e)f=h[c],f&&(0===c?i.push(f):i.push(b(f)));return i}()),a.replace(/[\s_-]+(\w)/g,function(a,b){return b.toUpperCase()})},m=function(a,b){return(b?"-":"")+e(a.split(d),"-").toLowerCase()},w=function(a){return e(a.split(d),"_").toLowerCase()},l=function(a){return e(a.split(d)," ")},x=function(a,b,c){var d,e,f;return null==b&&(b="span"),null==c&&(c={}),d=function(){var a;a=[];for(e in c)f=c[e],f&&("boolean"==typeof f&&(f=e),"function"==typeof f.join&&(f=f.join(" ")),a.push(" "+e+'="'+f+'"'));return a}(),h("<"+b+d.join("")+">",a,"</"+b+">")},q=function(a,b,c){var d,e,f,g,h,i;return null==c&&(c={}),g=c.more||"more",d=c.amp||"and",c.key&&(a=function(){var b,d,e;for(e=[],b=0,d=a.length;d>b;b++)h=a[b],"object"==typeof h&&e.push(h[c.key]);return e}()),c.wrap&&(a=function(){var b,d,e;for(e=[],b=0,d=a.length;d>b;b++)i=a[b],e.push(x(i,c.wrap));return e}()),b<(f=a.length)&&(e=f-b,c.quantify&&(g=t(g,e,{numberless:!0})),c.written&&(e=z(e,c.lang)),a=a.slice(0,b),a=a.concat(e+" "+g)),a.slice(0,-1).join(", ").concat(1===a.length?"":" "+d+" ",a.slice(-1))},n=function(a,b,c){return null==a&&(a=""),null==b&&(b=10),null==c&&(c=""),a.replace(new RegExp("(\\w{"+(b-1)+"})(\\w)","g"),function(a,b,d){return b+c+d})},t=function(a,b,c){var d,e,f,g,h,i,j,k;return g=null!=c?c:{},e=g.numberless,k=g.written,d=g.lang,f=g.plural,"string"!=typeof a&&(h=[a,b],b=h[0],a=h[1]),b=null!=(i=b.length)?i:b,j=1===b?a:f||a+"s",k&&(b=z(b,d)),b=e?"":b+" ",b+j},z=function(a,b,c){var d,e;return null==b&&(b="EN"),null==c&&(c="m"),(d=null!=(e=g[b])?e.cardinals.written[a-1]:void 0)?d[c]&&d[c]||d:a},u=function(a,b){var c,d,e;return d=function(){switch(b){case"s":case"single":return["‘","’"];case"a":case"angle":case"g":case"guillemets":return["«","»"];case"!":return["¡","!"];case"?":return["¿","?"];default:return["“","”"]}}(),c=d[0],e=d[1],h(c,a,e)},o=function(a,b,c){var d,e,f,h,i,j,k;return null==b&&(b={}),null==c&&(c="m"),e=g[b.lang||"EN"].ordinals,i=e.suffixes,f=e.rule,k=e.written,d=a.toString().match(f)[0],null!=b.written&&(j=k[+a-1])?j[c]||j:(h=i[d]||i.n,h=h[c]||h,b.wrap&&!j&&("boolean"==typeof b.wrap&&(b.wrap="sup"),h=x(h,b.wrap)),a+h)},r=function(a,b,c,d){return null==b&&(b=","),null==c&&(c=0),null==d&&(d="."),"number"==typeof b&&(c=b),a=p(a),c>0&&(a=a.toFixed(c)),d&&(a=a.toString().replace(".",d)),a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,b)},s=function(a,b){var c,d,e,f,g,h,i,j;return"object"==typeof b&&(h=b,b=h.currency,j=h.wrap,c=h.decimals,d=h.delimiter,e=h.dot),null==b&&(b="$"),null==c&&(c=2),null==e&&(e="."),a=r(a,d,c,e),j&&(i=a.split(e),g=i[0],f=i[1],a=g+x(f,j)),b+a},p=function(a){return"string"==typeof a&&(a=a.replace(/[^\d\.]+/g,"")/("%"===a.slice(-1)?100:1)),1/0>=a?a:-1},i=function(a,b){return Array.apply(0,{length:b-a+1}).map(function(b,c){return c+a})},k=function(a){var b,c,d,e;for(null==a&&(a={}),e=i(161,255).concat(i(338,402)).concat(i(8211,8230)).concat([8240,8364,8482]),c=0,d=e.length;d>c;c++)b=e[c],a[b]=String.fromCharCode(b);return a},j=function(a){return h("&#",a.charCodeAt(0),";")},v=function(a,b){return g[b]=a},y={camelCase:a,capitalize:b,capitalizeAll:c,cleanJoin:e,collapse:f,count:t,dasherize:m,dashify:m,enclose:h,glyph:j,glyphs:k,humanCase:l,hyphenate:n,hyphenCase:m,numerate:t,ordinal:o,parseNumber:p,prettyList:q,prettyNumber:r,prettyPrice:s,quantify:t,quote:u,setLanguage:v,slugify:w,snakeCase:w,titleCase:c,underscore:w,wrapInTag:x,writtenNumber:z}}); | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.written=b()}(this,function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return g={EN:{noncaps:/^(an|and|as|at|be|but|by|has|in|if|nor|of|off|on|or|out|per|the|to|up|was)$/,cardinals:{written:["one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"]},ordinals:{written:["first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth"],rule:/((1{0,1}[123])|(\d))\b/,suffixes:{1:"st",2:"nd",3:"rd",n:"th"}}}},b=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},c=function(a,c){var d,e;return null==c&&(c=g.EN.noncaps),"[object RegExp]"!==Object.prototype.toString.call(c)&&(c=g[c].noncaps),function(){var f,g,h,i;for(h=a.split(/\s/g),i=[],d=f=0,g=h.length;g>f;d=++f)e=h[d],d>0&&c.test(e)?i.push(e):i.push(b(e));return i}().join(" ")},h=function(a,b,c){return""+a+b+(c||a)},e=function(a,b){var c;return null==b&&(b=""),function(){var b,d,e;for(e=[],b=0,d=a.length;d>b;b++)c=a[b],c&&"string"==typeof c&&e.push(c);return e}().join(b)},f=function(a){return a.replace(/\s+/g," ")},d=/[-_\s]+|(!?[A-Z][a-z]*)/g,a=function(a){var c,f;return e(function(){var e,g,h,i;for(h=a.split(d),i=[],c=e=0,g=h.length;g>e;c=++e)f=h[c],f&&(0===c?i.push(f):i.push(b(f)));return i}()),a.replace(/[\s_-]+(\w)/g,function(a,b){return b.toUpperCase()})},m=function(a,b){return(b?"-":"")+e(a.split(d),"-").toLowerCase()},w=function(a){return e(a.split(d),"_").toLowerCase()},l=function(a){return e(a.split(d)," ")},x=function(a,b,c){var d,e,f;return null==b&&(b="span"),null==c&&(c={}),d=function(){var a;a=[];for(e in c)f=c[e],f&&("boolean"==typeof f&&(f=e),"function"==typeof f.join&&(f=f.join(" ")),a.push(" "+e+'="'+f+'"'));return a}(),h("<"+b+d.join("")+">",a,"</"+b+">")},q=function(a,b,c){var d,e,f,g,h,i;return null==c&&(c={}),g=c.more||"more",d=c.amp||"and",c.key&&(a=function(){var b,d,e;for(e=[],b=0,d=a.length;d>b;b++)h=a[b],"object"==typeof h&&e.push(h[c.key]);return e}()),c.wrap&&(a=function(){var b,d,e;for(e=[],b=0,d=a.length;d>b;b++)i=a[b],e.push(x(i,c.wrap));return e}()),b<(f=a.length)&&(e=f-b,c.quantify&&(g=t(g,e,{numberless:!0})),c.written&&(e=z(e,c.lang)),a=a.slice(0,b),a=a.concat(e+" "+g)),a.slice(0,-1).join(", ").concat(1===a.length?"":" "+d+" ",a.slice(-1))},n=function(a,b,c){return null==a&&(a=""),null==b&&(b=10),null==c&&(c=""),a.replace(new RegExp("(\\w{"+(b-1)+"})(\\w)","g"),function(a,b,d){return b+c+d})},t=function(a,b,c){var d,e,f,g,h,i,j,k;return g=null!=c?c:{},e=g.numberless,k=g.written,d=g.lang,f=g.plural,"string"!=typeof a&&(h=[a,b],b=h[0],a=h[1]),b=null!=(i=b.length)?i:b,j=1===b?a:f||a+"s",k&&(b=z(b,d)),b=e?"":b+" ",b+j},z=function(a,b,c){var d,e;return null==b&&(b="EN"),null==c&&(c="m"),(d=null!=(e=g[b])?e.cardinals.written[a-1]:void 0)?d[c]&&d[c]||d:a},u=function(a,b){var c,d,e;return d=function(){switch(b){case"s":case"single":return["‘","’"];case"a":case"angle":case"g":case"guillemets":return["«","»"];case"!":return["¡","!"];case"?":return["¿","?"];default:return["“","”"]}}(),c=d[0],e=d[1],h(c,a,e)},o=function(a,b,c){var d,e,f,h,i,j,k;return null==b&&(b={}),null==c&&(c="m"),e=g[b.lang||"EN"].ordinals,i=e.suffixes,f=e.rule,k=e.written,d=a.toString().match(f)[0],null!=b.written&&(j=k[+a-1])?j[c]||j:(h=i[d]||i.n,h=h[c]||h,b.wrap&&!j&&("boolean"==typeof b.wrap&&(b.wrap="sup"),h=x(h,b.wrap)),a+h)},r=function(a,b,c,d){return null==b&&(b=","),null==c&&(c=0),null==d&&(d="."),"number"==typeof b&&(c=b),a=p(a),c>0&&(a=a.toFixed(c)),d&&(a=a.toString().replace(".",d)),a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,b)},s=function(a,b){var c,d,e,f,g,h,i,j;return"object"==typeof b&&(h=b,b=h.currency,j=h.wrap,c=h.decimals,d=h.delimiter,e=h.dot),null==b&&(b="$"),null==c&&(c=2),null==e&&(e="."),a=r(a,d,c,e),j&&(i=a.split(e),g=i[0],f=i[1],a=g+x(f,j)),b+a},p=function(a){return"string"==typeof a&&(a=a.replace(/[^\d\.]+/g,"")/("%"===a.slice(-1)?100:1)),1/0>=a?a:-1},i=function(a,b){return Array.apply(0,{length:b-a+1}).map(function(b,c){return c+a})},k=function(a){var b,c,d,e;for(null==a&&(a={}),e=i(161,255).concat(i(338,402)).concat(i(8211,8230)).concat([8240,8364,8482]),c=0,d=e.length;d>c;c++)b=e[c],a[b]=String.fromCharCode(b);return a},j=function(a){return h("&#",a.charCodeAt(0),";")},v=function(a,b){return g[b]=a},y={camelCase:a,capitalize:b,capitalizeAll:c,cleanJoin:e,collapse:f,count:t,dasherize:m,dashify:m,enclose:h,glyph:j,glyphs:k,humanCase:l,hyphenate:n,hyphenCase:m,numerate:t,ordinal:o,parseNumber:p,prettyList:q,prettyNumber:r,prettyPrice:s,quantify:t,quote:u,setLanguage:v,slugify:w,snakeCase:w,titleCase:c,underscore:w,wrapInTag:x,writtenNumber:z}}); |
{ | ||
"name": "written", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Written provides a set of utilities for manipulating text, with a focus on providing typographic tools rather than pure string manipulation.", | ||
@@ -5,0 +5,0 @@ "main": "lib/written.js", |
@@ -124,3 +124,3 @@ ### written | ||
capitalizeAll = (str, regEx = dictionary["EN"].noncaps) -> | ||
unless toString.call(regEx) is "[object RegExp]" | ||
unless Object.prototype.toString.call(regEx) is "[object RegExp]" | ||
regEx = dictionary[regEx].noncaps | ||
@@ -127,0 +127,0 @@ |
36651