This repository has been archived by the owner on May 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
3,786 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"presets": [ | ||
"@babel/env" | ||
], | ||
"plugins": [ | ||
"@babel/proposal-class-properties", | ||
"@babel/proposal-object-rest-spread" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.idea | ||
|
||
.idea/ | ||
dist/ | ||
node_modules | ||
package-lock.json | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Utils | ||
# Cutils | ||
|
||
Some JavaScript util functions. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,40 @@ | ||
{ | ||
"name": "utils", | ||
"name": "cutils", | ||
"version": "0.1.0", | ||
"author": "Omar Desogus", | ||
"description": "Some JavaScript util functions.", | ||
"author": { | ||
"name": "Omar Desogus", | ||
"url": "https://cedoor.org" | ||
}, | ||
"license": "MIT", | ||
"main": "index.js", | ||
"main": "dist/cutils.js", | ||
"unpkg": "dist/cutils.min.js", | ||
"jsdelivr": "dist/cutils.min.js", | ||
"module": "src/index.js", | ||
"scripts": { | ||
"test": "mocha test.js" | ||
"pretest": "rollup -c", | ||
"test": "standard --fix 'src/**/*.js' 'test/**/*-test.js' && tape 'test/**/*.js'", | ||
"prepublishOnly": "rm -rf dist && npm run test" | ||
}, | ||
"homepage": "https://github.com/cedoor/utils#readme", | ||
"homepage": "https://github.com/cedoor/cutils", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cedoor/utils.git" | ||
"url": "git+https://github.com/cedoor/cutils.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/cedoor/utils/issues" | ||
"url": "https://github.com/cedoor/cutils/issues" | ||
}, | ||
"devDependencies": { | ||
"mocha": "5.2.0", | ||
"standard": "12.0.1" | ||
"@babel/core": "7.2.2", | ||
"@babel/plugin-proposal-class-properties": "7.3.0", | ||
"@babel/plugin-proposal-object-rest-spread": "7.3.1", | ||
"@babel/preset-env": "7.3.1", | ||
"rollup": "1.1.2", | ||
"rollup-plugin-babel": "4.3.2", | ||
"rollup-plugin-commonjs": "9.2.0", | ||
"rollup-plugin-node-resolve": "4.0.0", | ||
"rollup-plugin-terser": "4.0.3", | ||
"standard": "12.0.1", | ||
"tape": "4.9.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import commonjs from 'rollup-plugin-commonjs' | ||
import resolve from 'rollup-plugin-node-resolve' | ||
import babel from 'rollup-plugin-babel' | ||
import { terser } from 'rollup-plugin-terser' | ||
import * as meta from './package.json' | ||
|
||
const config = { | ||
input: meta.module, | ||
output: { | ||
file: `dist/${meta.name}.js`, | ||
name: meta.name, | ||
format: 'umd', | ||
indent: false, | ||
extend: true, | ||
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, | ||
}, | ||
plugins: [ | ||
resolve({extensions: ['.js']}), | ||
commonjs(), | ||
babel({extensions: ['.js'], include: ['src/**/*']}) | ||
] | ||
} | ||
|
||
export default [ | ||
config, | ||
{ | ||
...config, | ||
output: { | ||
...config.output, | ||
file: `dist/${meta.name}.min.js` | ||
}, | ||
plugins: [ | ||
...config.plugins, | ||
terser({ | ||
output: { | ||
preamble: config.output.banner | ||
} | ||
}) | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as general } from './general/index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const tape = require('tape'); | ||
const cutils = require('../dist/cutils') | ||
|
||
tape('timing test', function (test) { | ||
test.equal(cutils.general.capitalizeWord('hello'), 'Hello') | ||
test.equal(cutils.general.capitalizeWords('hello world'), 'Hello World') | ||
test.deepEqual(cutils.general.capitalizeWordList(['hello', 'world']), ['Hello', 'World']) | ||
test.end() | ||
}); |