upath
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -5,3 +5,3 @@ /** | ||
* A proxy to `path`, replacing `\` with `/` for all results & new methods to normalize & join keeping leading `./` and add, change, default, trim file extensions. | ||
* Version 1.0.0 - Compiled on 2017-02-07 15:36:16 | ||
* Version 1.0.2 - Compiled on 2017-11-13 23:11:15 | ||
* Repository git://github.com/anodynos/upath | ||
@@ -12,9 +12,8 @@ * Copyright(c) 2017 Angelos Pikoulas <agelos.pikoulas@gmail.com> | ||
// Generated by uRequire v0.7.0-beta.29 target: 'lib' template: 'nodejs' | ||
// Generated by uRequire v0.7.0-beta.33 target: 'lib' template: 'nodejs' | ||
var _ = require('lodash'); | ||
var VERSION = '1.0.0'; // injected by urequire-rc-inject-version | ||
var VERSION = '1.0.2'; // injected by urequire-rc-inject-version | ||
var extraFn, extraFunctions, isValidExt, name, path, propName, propValue, toUnix, upath, __slice = [].slice, __indexOf = [].indexOf || function (item) { | ||
var _, extraFn, extraFunctions, isValidExt, name, path, propName, propValue, toUnix, upath, slice = [].slice, indexOf = [].indexOf || function (item) { | ||
for (var i = 0, l = this.length; i < l; i++) { | ||
@@ -26,3 +25,8 @@ if (i in this && this[i] === item) | ||
}; | ||
_.mixin(require("underscore.string").exports()); | ||
_ = { | ||
startsWith: require("lodash.startswith"), | ||
endsWith: require("lodash.endswith"), | ||
isFunction: require("lodash.isfunction"), | ||
isString: require("lodash.isstring") | ||
}; | ||
path = require("path"); | ||
@@ -46,4 +50,4 @@ upath = exports; | ||
var args, result; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
args = _.map(args, function (p) { | ||
args = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
args = args.map(function (p) { | ||
if (_.isString(p)) { | ||
@@ -84,3 +88,3 @@ return toUnix(p); | ||
if (_.endsWith(p, "/")) { | ||
return p.slice(0, p.length - 2 + 1 || 9000000000); | ||
return p.slice(0, +(p.length - 2) + 1 || 9000000000); | ||
} else { | ||
@@ -92,3 +96,3 @@ return p; | ||
var p, result; | ||
p = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
p = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
result = upath.join.apply(null, p); | ||
@@ -117,3 +121,3 @@ if (_.startsWith(p[0], "./") && !_.startsWith(result, "./")) { | ||
if (isValidExt(oldExt, ignoreExts, maxSize)) { | ||
return filename.slice(0, filename.length - oldExt.length - 1 + 1 || 9000000000); | ||
return filename.slice(0, +(filename.length - oldExt.length - 1) + 1 || 9000000000); | ||
} else { | ||
@@ -155,3 +159,6 @@ return filename; | ||
isValidExt = function (ext, ignoreExts, maxSize) { | ||
return ext && ext.length <= maxSize && __indexOf.call(_.map(ignoreExts, function (e) { | ||
if (ignoreExts == null) { | ||
ignoreExts = []; | ||
} | ||
return ext && ext.length <= maxSize && indexOf.call(ignoreExts.map(function (e) { | ||
return (e && e[0] !== "." ? "." : "") + e; | ||
@@ -162,3 +169,3 @@ }), ext) < 0; | ||
extraFn = extraFunctions[name]; | ||
if (!_.isUndefined(upath[name])) { | ||
if (upath[name] !== void 0) { | ||
throw new Error("path." + name + " already exists."); | ||
@@ -165,0 +172,0 @@ } else { |
{ | ||
"name": "upath", | ||
"description": "A proxy to `path`, replacing `\\` with `/` for all results & new methods to normalize & join keeping leading `./` and add, change, default, trim file extensions.", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"homepage": "http://github.com/anodynos/upath/", | ||
@@ -43,16 +43,20 @@ "author": { | ||
"engines": { | ||
"node": ">=0.10 <=7" | ||
"node": ">=4 <=9" | ||
}, | ||
"dependencies": { | ||
"lodash": "3.x", | ||
"underscore.string": "2.3.x" | ||
"lodash.endswith": "^4.2.1", | ||
"lodash.startswith": "^4.2.1", | ||
"lodash.isfunction": "^3.0.8", | ||
"lodash.isstring": "^4.0.1" | ||
}, | ||
"devDependencies": { | ||
"chai": "3.5.x", | ||
"chai": "~4.0.2", | ||
"coffee-script": "1.12.6", | ||
"grunt": "0.4.5", | ||
"grunt-contrib-watch": "0.6.x", | ||
"grunt-contrib-watch": "~1.0.0", | ||
"grunt-urequire": "0.7.x", | ||
"mocha": "2.4.x", | ||
"mocha": "~3.4.2", | ||
"uberscore": "0.0.19", | ||
"urequire": "0.7.0-beta.29", | ||
"underscore.string": "~3.3.4", | ||
"urequire": "0.7.0-beta.33", | ||
"urequire-ab-specrunner": "^0.2.5", | ||
@@ -59,0 +63,0 @@ "urequire-rc-inject-version": "^0.1.6" |
@@ -1,2 +0,2 @@ | ||
# upath v1.0.0 | ||
# upath v1.0.1 | ||
@@ -22,8 +22,7 @@ [![Build Status](https://travis-ci.org/anodynos/upath.svg?branch=master)](https://travis-ci.org/anodynos/upath) | ||
Normal `path` doesn't convert paths to a unified format (ie `/`) before calculating paths (`normalize`, `join`), which can lead to numerous problems. | ||
Also path joining, normalization etc on the two formats is not consistent, depending on where it runs - last checked with nodejs 0.10.32 running on Linux & Windows x64. | ||
Running on Windows `path` yields different results. | ||
Also path joining, normalization etc on the two formats is not consistent, depending on where it runs. Running `path` on Windows yields different results than when it runs on Linux / Mac. | ||
In general, if you code your paths logic while developing on Unix/Mac and it runs on Windows, you may run into problems when using `path`. | ||
Note that using **Unix `/` on Windows** works perfectly inside nodejs (and other languages), so there's no reason to stick to the legacy. | ||
Note that using **Unix `/` on Windows** works perfectly inside nodejs (and other languages), so there's no reason to stick to the Windows legacy at all. | ||
@@ -294,4 +293,4 @@ ##### Examples / specs | ||
✓ `'fileWith/defaultExt.longExt'` ---> `'fileWith/defaultExt.longExt'` | ||
It is ignoring `.min` & `.dev` as extensions, and considers exts with up to 8 chars. | ||
@@ -308,3 +307,3 @@ | ||
Copyright(c) 2014 Agelos Pikoulas (agelos.pikoulas@gmail.com) | ||
Copyright(c) 2014-2017 Angelos Pikoulas (agelos.pikoulas@gmail.com) | ||
@@ -311,0 +310,0 @@ Permission is hereby granted, free of charge, to any person |
Sorry, the diff of this file is not supported yet
388
33694
4
11
5
327
+ Addedlodash.endswith@^4.2.1
+ Addedlodash.isfunction@^3.0.8
+ Addedlodash.isstring@^4.0.1
+ Addedlodash.startswith@^4.2.1
+ Addedlodash.endswith@4.2.1(transitive)
+ Addedlodash.isfunction@3.0.9(transitive)
+ Addedlodash.isstring@4.0.1(transitive)
+ Addedlodash.startswith@4.2.1(transitive)
- Removedlodash@3.x
- Removedunderscore.string@2.3.x
- Removedlodash@3.10.1(transitive)
- Removedunderscore.string@2.3.3(transitive)