文件名称:无任何依赖的string操作库Strman.zip
文件大小:1.05MB
文件格式:ZIP
更新时间:2022-08-07 21:41:51
开源项目
Strman是无任何依赖的string操作库,前后端通用。安装:npm install strman --save或者bower install strman用法With ES6/import import {slugify} from 'strman'; let title = "A Javascript string manipulation library."; let result = slugify(title); // result => "a-javascript-string-manipulation-library"With require var slugify = require('strman').slugify; let title = "A Javascript string manipulation library."; let result = slugify(title); // result => "a-javascript-string-manipulation-library"With Browser [removed][removed] var result = _s.isString('strman'); // result => true说明npm依赖分2种,常规依赖和dev依赖。strman没有任何常规依赖,也就是它自己说的:“without npm dependences”,但它是es 6语法,借助babel开发的,这是开发阶段使用的依赖看一下它的package.json"main": "dist/strman.js",dist是压缩后的目录,也就是说它的模块主文件是压缩后的。根目录里有一个gulpfile.babel.js用于压缩混淆,这就很明显了 gulp.task('browserify', () => { browserify({ entries: './src/strman.js', transform: [babelify, es6ify, deglobalify], // Generate a UMD bundle for the supplied export name. // This bundle works with other module systems and sets the name // given as a window global if no module system is found. standalone: '_s', // Enable source maps that allow you to debug your files // separately. debug: true }) .bundle() .pipe(source('strman.js')) .pipe(buffer()) .pipe(uglify()) .pipe(gulp.dest('dist')) .pipe(gulp.dest('public')); }); 标签:Strman