vendor: 4,488 bytes, lines 1-24
1/*! 2 * accounting.js v0.4.2 3 * Copyright 2014 Open Exchange Rates 4 * 5 * Freely distributable under the MIT license. 6 * Portions of accounting.js are inspired or borrowed from underscore.js 7 * 8 * Full details and documentation: 9 * http://openexchangerates.github.io/accounting.js/ 10 */ 11(function(root,undefined){var lib={};lib.version='0.4.1';lib.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var nativeMap=Array.prototype.map,nativeIsArray=Array.isArray,toString=Object.prototype.toString;function isString(obj){return!!(obj===''||(obj&&obj.charCodeAt&&obj.substr))} 12function isArray(obj){return nativeIsArray?nativeIsArray(obj):toString.call(obj)==='[object Array]'} 13function isObject(obj){return obj&&toString.call(obj)==='[object Object]'} 14function defaults(object,defs){var key;object=object||{};defs=defs||{};for(key in defs){if(defs.hasOwnProperty(key)){if(object[key]==null)object[key]=defs[key]}} 15return object} 16function map(obj,iterator,context){var results=[],i,j;if(!obj)return results;if(nativeMap&&obj.map===nativeMap)return obj.map(iterator,context);for(i=0,j=obj.length;i<j;i++){results[i]=iterator.call(context,obj[i],i,obj)} 17return results} 18function checkPrecision(val,base){val=Math.round(Math.abs(val));return isNaN(val)?base:val} 19function checkCurrencyFormat(format){var defaults=lib.settings.currency.format;if(typeof format==="function")format=format();if(isString(format)&&format.match("%v")){return{pos:format,neg:format.replace("-","").replace("%v","-%v"),zero:format}}else if(!format||!format.pos||!format.pos.match("%v")){return(!isString(defaults))?defaults:lib.settings.currency.format={pos:defaults,neg:defaults.replace("%v","-%v"),zero:defaults}} 20return format} 21var unformat=lib.unformat=lib.parse=function(value,decimal){if(isArray(value)){return map(value,function(val){return unformat(val,decimal)})} 22value=value||0;if(typeof value==="number")return value;decimal=decimal||lib.settings.number.decimal;var regex=new RegExp("[^0-9-"+decimal+"]",["g"]),unformatted=parseFloat((""+value).replace(/\((.*)\)/,"-$1").replace(regex,'').replace(decimal,'.'));return!isNaN(unformatted)?unformatted:0};var toFixed=lib.toFixed=function(value,precision){precision=checkPrecision(precision,lib.settings.number.precision);var power=Math.pow(10,precision);return(Math.round(lib.unformat(value)*power)/power).toFixed(precision)};var formatNumber=lib.formatNumber=lib.format=function(number,precision,thousand,decimal){if(isArray(number)){return map(number,function(val){return formatNumber(val,precision,thousand,decimal)})} 23number=unformat(number);var opts=defaults((isObject(precision)?precision:{precision:precision,thousand:thousand,decimal:decimal}),lib.settings.number),usePrecision=checkPrecision(opts.precision),negative=number<0?"-":"",base=parseInt(toFixed(Math.abs(number||0),usePrecision),10)+"",mod=base.length>3?base.length%3:0;return negative+(mod?base.substr(0,mod)+opts.thousand:"")+base.substr(mod).replace(/(\d{3})(?=\d)/g,"$1"+opts.thousand)+(usePrecision?opts.decimal+toFixed(Math.abs(number),usePrecision).split('.')[1]:"")};var formatMoney=lib.formatMoney=function(number,symbol,precision,thousand,decimal,format){if(isArray(number)){return map(number,function(val){return formatMoney(val,symbol,precision,thousand,decimal,format)})} 24number=unformat(number);var opts=defaults((isObject(symbol)?symbol:{symbol:symbol,precision:precision,thousand:thousand,decimal:decimal,format:format}),lib.settings.currency),formats=checkCurrencyFormat(opts.format),useFormat=number>0?formats.pos:number<0?formats.neg:formats.zero;return useFormat.replace('%s',opts.symbol).replace('%v',formatNumber(Math.abs(number),checkPrecision(opts.precision),opts.thousand,opts.decimal))};lib.formatColumn=function(list,symbol,precision,thousand,decimal,format){if(!list)return[];var opts=defaults((isObject(symbol)?symbol:{symbol:symbol,precision:precision,thousand:thousand,decimal:decimal,format:format}),lib.settings.currency),formats=checkCurrencyFormat(opts.format),padAfterSymbol=formats.pos.indexOf("%s")<formats.pos.indexOf("%v")?!0:!1,maxLength=0,formatted=map(list,function(val,i){if(isArray(val)){return lib.formatColumn(val,opts)}else{val=unformat(val);var useFormat=val>0?formats.pos:val<0?formats.neg:formats.zero,fVal=useFormat.replace('%s',opts.symbol).replace('%v',formatNumber(Math.abs(val),checkPrecision(opts.precision),opts.thousand,opts.decimal));
24if(fVal.length>maxLength)maxLength=fVal.length;return fVal}});return map(formatted,function(val,i){if(isString(val)&&val.length<maxLength){return padAfterSymbol?val.replace(opts.symbol,opts.symbol+(new Array(maxLength-val.length+1).join(" "))):(new Array(maxLength-val.length+1).join(" "))+val} 25return val})};if(typeof exports!=='undefined'){if(typeof module!=='undefined'&&module.exports){exports=module.exports=lib} 26exports.accounting=lib}else if(typeof define==='function'&&define.amd){define([],function(){return lib})}else{lib.noConflict=(function(oldAccounting){return function(){root.accounting=oldAccounting;lib.noConflict=undefined;return lib}})(root.accounting);root.accounting=lib}}(this))
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.