mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
add 'path' to stdlib. bad? not in commonjs but in node.js
This commit is contained in:
15
src/stdlib/path.coffee
Normal file
15
src/stdlib/path.coffee
Normal file
@@ -0,0 +1,15 @@
|
||||
# node.js path module
|
||||
# http://nodejs.org/docs/v0.6.0/api/path.html
|
||||
|
||||
_ = require 'underscore'
|
||||
|
||||
module.exports =
|
||||
# Return the last portion of a path. Similar to the Unix basename command.
|
||||
basename: (filepath) ->
|
||||
_.last filepath.split '/'
|
||||
|
||||
# Return the extension of the path, from the last '.' to end of string in
|
||||
# the last portion of the path. If there is no '.' in the last portion of
|
||||
# the path or the first character of it is '.', then it returns an empty string.
|
||||
extname: (filepath) ->
|
||||
_.last filepath.split '.'
|
||||
Reference in New Issue
Block a user