[Pkg-javascript-commits] [node-umd] 04/11: Make Cammel Case less surprising/forcefull
Bastien Roucariès
rouca at moszumanska.debian.org
Mon Apr 17 07:38:04 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to annotated tag 1.2.0
in repository node-umd.
commit d606f5a01181a9c40f06d4b70d55936a8725b590
Author: ForbesLindesay <forbes at lindesay.co.uk>
Date: Sun Mar 31 20:24:16 2013 +0100
Make Cammel Case less surprising/forcefull
[closes #1]
---
examples/build.js | 5 +++++
examples/constructor/bundle.js | 3 +++
examples/constructor/index.js | 1 +
index.js | 7 ++-----
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/examples/build.js b/examples/build.js
index 971dcaf..a2eeb99 100644
--- a/examples/build.js
+++ b/examples/build.js
@@ -11,10 +11,15 @@ fs.createReadStream(join(__dirname, 'raw', 'index.js'))
.pipe(umd('common-js-module', false))
.pipe(fs.createWriteStream(join(__dirname, 'raw', 'bundle.js')))
.on('close', end);
+fs.createReadStream(join(__dirname, 'constructor', 'index.js'))
+ .pipe(umd('Common-Js-Module', false))
+ .pipe(fs.createWriteStream(join(__dirname, 'constructor', 'bundle.js')))
+ .on('close', end);
var remaining = 2;
function end() {
if (0 !== --remaining) return;
console.log(require('./cjs/bundle'));
console.log(require('./raw/bundle'));
+ console.log(require('./constructor/bundle'));
}
\ No newline at end of file
diff --git a/examples/constructor/bundle.js b/examples/constructor/bundle.js
new file mode 100644
index 0000000..6212ca0
--- /dev/null
+++ b/examples/constructor/bundle.js
@@ -0,0 +1,3 @@
+(function(e){if("function"==typeof bootstrap)bootstrap("common-js-module",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeCommonJsModule=e}else"undefined"!=typeof window?window.CommonJsModule=e():global.CommonJsModule=e()})(function(){var define,ses,bootstrap,module,exports;
+return "Constructor example";
+});
\ No newline at end of file
diff --git a/examples/constructor/index.js b/examples/constructor/index.js
new file mode 100644
index 0000000..5bb5266
--- /dev/null
+++ b/examples/constructor/index.js
@@ -0,0 +1 @@
+return "Constructor example";
\ No newline at end of file
diff --git a/index.js b/index.js
index a388e07..05564db 100644
--- a/index.js
+++ b/index.js
@@ -55,12 +55,9 @@ exports.postlude = function (moduleName, cjs) {
function pascalCase(name) {
- name = name.replace(/\-([a-z])/g, function (_, char) { return char.toUpperCase(); });
- name = name.replace(/[^a-zA-Z0-9]+/g, '');
- return name.replace(/^[a-z]/, function (char) { return char.toUpperCase(); });
+ return camelCase(name).replace(/^[a-z]/, function (char) { return char.toUpperCase(); });
}
function camelCase(name) {
name = name.replace(/\-([a-z])/g, function (_, char) { return char.toUpperCase(); });
- name = name.replace(/[^a-zA-Z0-9]+/g, '');
- return name.replace(/^[A-Z]/, function (char) { return char.toLowerCase(); });
+ return name.replace(/[^a-zA-Z0-9]+/g, '');
}
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-umd.git
More information about the Pkg-javascript-commits
mailing list