filer/dist/path.min.js

2 lines
2.5 KiB
JavaScript

/*! filer 0.0.41 2015-06-01 */
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Path=t()}}(function(){return function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);throw Error("Cannot find module '"+s+"'")}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;r.length>s;s++)i(r[s]);return i}({1:[function(t,e,n){function r(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function i(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var i=n>=0?arguments[n]:"/";"string"==typeof i&&i&&(t=i+"/"+t,e="/"===i.charAt(0))}return t=r(t.split("/").filter(function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."}function o(t){var e="/"===t.charAt(0);return"/"===t.substr(-1),t=r(t.split("/").filter(function(t){return!!t}),!e).join("/"),t||e||(t="."),(e?"/":"")+t}function s(){var t=Array.prototype.slice.call(arguments,0);return o(t.filter(function(t){return t&&"string"==typeof t}).join("/"))}function a(t,e){function r(t){for(var e=0;t.length>e&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),o=r(e.split("/")),s=Math.min(i.length,o.length),a=s,u=0;s>u;u++)if(i[u]!==o[u]){a=u;break}for(var c=[],u=a;i.length>u;u++)c.push("..");return c=c.concat(o.slice(a)),c.join("/")}function u(t){var e=v(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function c(t,e){var n=v(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),""===n?"/":n}function f(t){return v(t)[3]}function l(t){return"/"===t.charAt(0)?!0:!1}function h(t){return-1!==(""+t).indexOf("\0")?!0:!1}function p(t){return t.replace(/\/*$/,"/")}function d(t){return t=t.replace(/\/*$/,""),""===t?"/":t}var g=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/,v=function(t){var e=g.exec(t);return[e[1]||"",e[2]||"",e[3]||"",e[4]||""]};e.exports={normalize:o,resolve:i,join:s,relative:a,sep:"/",delimiter:":",dirname:u,basename:c,extname:f,isAbsolute:l,isNull:h,addTrailing:p,removeTrailing:d}},{}]},{},[1])(1)});