UNPKG

574 BJavaScriptView Raw
1(function() {
2 module.exports = function($) {
3 var fse, normalizePath, wrapList;
4 ({normalizePath, wrapList} = $.fn);
5 fse = require('fs-extra');
6
7 // return
8 return $.link_ = async function(source, target) {
9 if (!(source && target)) {
10 throw new Error('invalid argument length');
11 }
12 source = normalizePath(source);
13 target = normalizePath(target);
14 await fse.ensureSymlink(source, target);
15 $.info('link', `linked ${wrapList(source)} to ${wrapList(target)}`);
16 return $; // return
17 };
18 };
19
20}).call(this);