Permalink
Browse files

compile with coffeemill

  • Loading branch information...
1 parent e6d4d13 commit bb2a76c8324f87bef5aee9142d894798ce38246f @minodisk committed Apr 10, 2012
Showing with 74 additions and 187 deletions.
  1. +7 −6 README.md
  2. +22 −17 lib/browser/sorter.js
  3. +1 −1 lib/browser/sorter.min.js
  4. +20 −19 lib/node/sorter.js
  5. +0 −123 makefile.coffee
  6. +24 −21 src/sorter.coffee
View
@@ -1,13 +1,14 @@
-# SorterJS
+# Sorter
Dictionary and natural sort module for Node.js, RequireJS and browser.
+Supports 2 bytes character in English and Japanese.
-## Installation
-
-### Node.js
+## Installation at Node.js
$ npm install sorter
+## Adding to browser
+
### RequireJS
<script type="text/javascript" src="require.js"></script>
@@ -28,5 +29,5 @@ Dictionary and natural sort module for Node.js, RequireJS and browser.
## API Documentation
-* **dictionarySort(array, key = null)** -
-* **naturalSort(array, key = null)** -
+* **dictSort(array, key = null)** -
+* **natSort(array, key = null)** -
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1 +1 @@
-((function(){var a,b,c,d,e,f,g,h,i;c=/([0-9 \uff10-\uff19\u3000]+)|([^0-9 \uff10-\uff19\u3000]+)/g,b=/[\uff10-\uff19]/g,a={en:{encode:{ABCDEFGHIJKLMNOPQRSTUVWXYZ:["ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz","abcdefghijklmnopqrstuvwxyz"],"01234567890":["0123456789"]}},ja:{encode:{"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもや ゆ よらりるれろわゐ ゑをん":["ぁぃぅぇぉ っ ゃ ゅ ょ ゎ","ァィゥェォヵ ヶ ッ ャ ュ ョ ヮ","ァィゥェォ ッ ャ ュ ョ","あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもや ゆ よらりるれろわゐ ゑをん","アイウエオカキクケコサシスセソタチツデトナニヌネノハヒフヘホマミムメモヤ ユ ヨラリルレロワヰ ヱヲン","アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤ ユ ヨラリルレロワ ヲン"," ゔ がぎぐげござじずぜぞだぢづでど ばびぶべぼ"," ヴ ガギグゲゴザジズゼゾダヂヅデド バビブベボ"," ぱぴぷぺぽ"," パピプペポ"]},"long":{"ー":{"ぁぃぅぇぉ":[" っ","ゃ ゅ ょ","ゎ"],"ァィゥェォ":["ヵ ヶ"," ッ","ャ ュ ョ","ヮ"],"ァィゥェォ":[" ッ","ャ ュ ョ"],"あいうえお":["かきくけこ","さしすせそ","たちつてと","なにぬねの","はひふへほ","まみむめも","や ゆ よ","らりるれろ","わゐ ゑを"," ゔ","がぎぐげご","ざじずぜぞ","だぢづでど","ばびぶべぼ","ぱぴぷぺぽ"],"アイウエオ":["カキクケコ","サシスセソ","タチツデト","ナニヌネノ","ハヒフヘホ","マミムメモ","ヤ ユ ヨ","ラリルレロ","ワヰ ヱヲ"," ヴ","ガギグゲゴ","ザジズゼゾ","ダヂヅデド","バビブベボ","パピプペポ"],"アイウエオ":["カキクケコ","サシスセソ","タチツテト","ナニヌネノ","ハヒフヘホ","マミムメモ","ヤ ユ ヨ","ラリルレロ","ワ ヲ"]}}}},e={encode:[],"long":{}},function(){var b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;x=[];for(j in a){g=a[j],w=g.encode;for(s in w){p=w[s],r=[];for(h=0,t=s.length;h<t;h++)q=s[h],r[h]=s.charCodeAt(h);f=Math.pow(.1,String(p.length).length+1);for(h=0,u=p.length;h<u;h++){o=p[h],d=f*(h+1),c={min:Infinity,max:-Infinity,map:{}};for(i=0,v=o.length;i<v;i++)m=o[i],b=o.charCodeAt(i),b!==32&&(c.map[b]=r[i]+d),b<c.min&&(c.min=b),b>c.max&&(c.max=b);e.encode.push(c)}}x.push(function(){var a,b,d,f,i,j;i=g.long,j=[];for(k in i){c=i[k],l={};for(s in c){p=c[s],r=[];for(h=0,b=s.length;h<b;h++)q=s[h],r[h]=s.charCodeAt(h);for(a=0,d=p.length;a<d;a++){o=p[a];for(h=0,f=o.length;h<f;h++)m=o[h],n=o.charCodeAt(h),n!==32&&(l[n]=r[h])}}j.push(e.long[k.charCodeAt(0)]=l)}return j}())}return x}(),f={},f.dictionary=function(a,b){return b==null&&(b=null),a.sort(function(a,c){return b&&(a=a[b],c=c[b]),d(a,c)}),a},d=function(a,b){var c,d,e,f;d=0;for(e=0,f=Math.min(a.length,b.length);e<f;e+=1){c=i(a,e)-i(b,e);if(c<-0.1||c>.1)return c;d===0&&(d=c)}return(c=a.length-b.length)!==0?c:d},i=function(a,b){var c,d,f,g,h;c=a.charCodeAt(b),b>0&&(g=e.long[c])!=null&&(h=a.charCodeAt(b-1),(d=g[h])!=null&&(c=d)),f=e.encode.length;while(f--){g=e.encode[f];if(c>=g.min&&c<=g.max&&g.map[c]!=null)return g.map[c]}return c},f.naturalSort=function(a,b){var c,d,e,f,i;b==null&&(b=null),e=[],console.log(a);for(d=0,i=a.length;d<i;d++)f=a[d],f=b?f[b]:f,e[d]={raw:f,chunks:h(f)};e.sort(g),c=[],d=e.length;while(d--)c[d]=e[d].raw;return c},h=function(a){var d;return d=[],a.replace(c,function(a,c,e){var f;return f={},c&&(f.num=Number(c.replace(b,function(a){return"0123456789".indexOf(a)}))),f.str=a,d.push(f)}),d},g=function(a,b){var c,e,f,g,h;a=a.chunks,b=b.chunks,e=0;for(f=0,g=Math.min(a.length,b.length);f<g;f+=1)if(typeof a[f].num!="undefined"&&typeof b[f].num!="undefined"){if((c=a[f].num-b[f].num)!==0)return c;(c=a[f].str.length-b[f].str.length)!==0?e===0&&(e=(h=c<0)!=null?h:-{.1:.1}):e===0&&(e=d(a[f].str,b[f].str))}else{if(typeof a[f].num!="undefined")return d(a[f].str,b[f].str);if(typeof b[f].num!="undefined")return d(a[f].str,b[f].str);c=d(a[f].str,b[f].str);if(c<-0.1||c>.1)return c;e===0&&(e=c)}return c=a.length-b.length,c!==0?c:e},typeof define!="undefined"&&define!==null?define(function(){return f}):typeof window!="undefined"&&window!==null&&(window.mn==null&&(window.mn={}),window.mn.dsk==null&&(window.mn.dsk={}),window.mn.dsk.sorter==null&&(window.mn.dsk.sorter=f))})).call(this)
+undefined
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit bb2a76c

Please sign in to comment.