Skip to content

Commit 5000785

Browse files
committed
feat: initial commit
0 parents  commit 5000785

11 files changed

+7600
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
*.log
3+
.idea
4+
node_modules
5+
coverage
6+
.nyc_output

.remarkignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/snapshots/**/*.md

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: node_js
2+
node_js:
3+
- '8'
4+
- '10'
5+
script:
6+
npm run test-coverage
7+
after_success:
8+
npm run coverage

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Nick Baugh <[email protected]> (http://niftylettuce.com/)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# dayjs-with-plugins
2+
3+
[![build status](https://img.shields.io/travis/com/niftylettuce/dayjs-with-plugins.svg)](https://travis-ci.com/niftylettuce/dayjs-with-plugins)
4+
[![code coverage](https://img.shields.io/codecov/c/github/niftylettuce/dayjs-with-plugins.svg)](https://codecov.io/gh/niftylettuce/dayjs-with-plugins)
5+
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
6+
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
7+
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
8+
[![license](https://img.shields.io/github/license/niftylettuce/dayjs-with-plugins.svg)](LICENSE)
9+
[![npm downloads](https://img.shields.io/npm/dt/dayjs-with-plugins.svg)](https://npm.im/dayjs-with-plugins)
10+
11+
> Day.js with all plugins added out of the box, no need to use dayjs.extend!
12+
13+
14+
## Table of Contents
15+
16+
* [Install](#install)
17+
* [Usage](#usage)
18+
* [Contributors](#contributors)
19+
* [License](#license)
20+
21+
22+
## Install
23+
24+
[npm][]:
25+
26+
```sh
27+
npm install dayjs dayjs-with-plugins
28+
```
29+
30+
[yarn][]:
31+
32+
```sh
33+
yarn add dayjs dayjs-with-plugins
34+
```
35+
36+
37+
## Usage
38+
39+
```js
40+
const dayjs = require('dayjs-with-plugins');
41+
42+
// ...
43+
```
44+
45+
46+
## Contributors
47+
48+
| Name | Website |
49+
| -------------- | -------------------------- |
50+
| **Nick Baugh** | <http://niftylettuce.com/> |
51+
52+
53+
## License
54+
55+
[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)
56+
57+
58+
##
59+
60+
[npm]: https://www.npmjs.com/
61+
62+
[yarn]: https://yarnpkg.com/

index.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const dayjs = require('dayjs');
2+
const debug = require('debug')('dayjs-with-plugins');
3+
4+
[
5+
'advancedFormat',
6+
'badMutable',
7+
'buddhistEra',
8+
'calendar',
9+
'customParseFormat',
10+
'dayOfYear',
11+
'isBetween',
12+
'isLeapYear',
13+
'isMoment',
14+
'isSameOrAfter',
15+
'isSameOrBefore',
16+
'isoWeeksInYear',
17+
'localeData',
18+
'localizedFormat',
19+
'minMax',
20+
'quarterOfYear',
21+
'relativeTime',
22+
'toArray',
23+
'toObject',
24+
'utc',
25+
'weekOfYear',
26+
'weekYear',
27+
'weekday'
28+
].forEach(pluginName => {
29+
try {
30+
const plugin = require(`dayjs/plugin/${pluginName}`);
31+
dayjs.extend(plugin);
32+
debug(`added ${plugin} plugin to dayjs with dayjs.extend`);
33+
} catch (err) {
34+
debug(err);
35+
}
36+
});
37+
38+
module.exports = dayjs;

package.json

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{
2+
"name": "dayjs-with-plugins",
3+
"description": "Day.js with all plugins added out of the box, no need to use dayjs.extend!",
4+
"version": "0.0.0",
5+
"author": "Nick Baugh <[email protected]> (http://niftylettuce.com/)",
6+
"ava": {
7+
"verbose": true
8+
},
9+
"bugs": {
10+
"url": "https://github.com/niftylettuce/dayjs-with-plugins/issues",
11+
"email": "[email protected]"
12+
},
13+
"commitlint": {
14+
"extends": [
15+
"@commitlint/config-conventional"
16+
]
17+
},
18+
"contributors": [
19+
"Nick Baugh <[email protected]> (http://niftylettuce.com/)"
20+
],
21+
"dependencies": {
22+
"debug": "^4.1.1"
23+
},
24+
"devDependencies": {
25+
"@commitlint/cli": "latest",
26+
"@commitlint/config-conventional": "latest",
27+
"ava": "latest",
28+
"codecov": "latest",
29+
"cross-env": "latest",
30+
"dayjs": "^1.8.16",
31+
"eslint": "latest",
32+
"eslint-config-xo-lass": "latest",
33+
"fixpack": "latest",
34+
"husky": "latest",
35+
"lint-staged": "latest",
36+
"nyc": "latest",
37+
"remark-cli": "latest",
38+
"remark-preset-github": "latest",
39+
"xo": "latest"
40+
},
41+
"engines": {
42+
"node": ">=8.3"
43+
},
44+
"homepage": "https://github.com/niftylettuce/dayjs-with-plugins",
45+
"husky": {
46+
"hooks": {
47+
"pre-commit": "npm test",
48+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
49+
}
50+
},
51+
"keywords": [
52+
"all",
53+
"alternative",
54+
"date",
55+
"day",
56+
"dayjs",
57+
"drop",
58+
"fast",
59+
"format",
60+
"formatting",
61+
"in",
62+
"moment",
63+
"momentjs",
64+
"performance",
65+
"plugins",
66+
"replacement"
67+
],
68+
"license": "MIT",
69+
"lint-staged": {
70+
"*.js": [
71+
"xo --fix",
72+
"git add"
73+
],
74+
"*.md": [
75+
"remark . -qfo",
76+
"git add"
77+
],
78+
"package.json": [
79+
"fixpack",
80+
"git add"
81+
]
82+
},
83+
"main": "index.js",
84+
"prettier": {
85+
"singleQuote": true,
86+
"bracketSpacing": true,
87+
"trailingComma": "none"
88+
},
89+
"remarkConfig": {
90+
"plugins": [
91+
"preset-github"
92+
]
93+
},
94+
"repository": {
95+
"type": "git",
96+
"url": "https://github.com/niftylettuce/dayjs-with-plugins"
97+
},
98+
"scripts": {
99+
"ava": "cross-env NODE_ENV=test ava",
100+
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
101+
"lint": "xo && remark . -qfo",
102+
"nyc": "cross-env NODE_ENV=test nyc ava",
103+
"test": "npm run lint && npm run ava",
104+
"test-coverage": "npm run lint && npm run nyc"
105+
},
106+
"xo": {
107+
"prettier": true,
108+
"space": true,
109+
"extends": [
110+
"xo-lass"
111+
]
112+
},
113+
"peerDependencies": {
114+
"dayjs": "*"
115+
}
116+
}

test/test.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const test = require('ava');
2+
3+
const dayjs = require('..');
4+
5+
test('exports dayjs function', t => {
6+
t.true(typeof dayjs === 'function');
7+
});

0 commit comments

Comments
 (0)