-
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.
Merge pull request #1 from sajera/improvement_for_source_of_helper
Improvement for source of helper
- Loading branch information
Showing
41 changed files
with
2,839 additions
and
236 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,38 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.html] | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.styl,*.scss,*.css,*.less] | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[{package.json,bower.json,.eslintrc}] | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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,18 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"complexity": [2, 16], | ||
"max-nested-callbacks": [2, 3], | ||
"max-params": [2, 4], | ||
"max-statements": [2, 30], | ||
"no-extra-parens": [0], | ||
"no-magic-numbers": [0], | ||
"no-restricted-syntax": [2, "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"], | ||
"operator-linebreak": [2, "before"], | ||
"spaced-comment": [0], | ||
"strict": [0] | ||
} | ||
} |
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,4 @@ | ||
node_modules/* | ||
bower_components/* | ||
*.log | ||
old/* |
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,14 @@ | ||
node_modules/* | ||
bower_components/* | ||
old/* | ||
lib/* | ||
tables/* | ||
test/* | ||
*.log | ||
*.md | ||
bower.json | ||
gulpfile.js | ||
.eslintrc.json | ||
.gitignore | ||
.npmignore | ||
.editorconfig |
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,31 +1,30 @@ | ||
{ | ||
"name": "s-uid", | ||
"main": "uid.min.js", | ||
"version": "1.3.0", | ||
"private": false, | ||
"description": "Generate id from base string", | ||
"ignore": [ | ||
"node_modules", | ||
"bower_components", | ||
"package.json", | ||
"bower.json", | ||
"gulpfile.js", | ||
"lib", | ||
"test.*" | ||
], | ||
"keywords": [ | ||
"s-uid", | ||
"uid" | ||
], | ||
"homepage": "https://github.com/sajera/s-uid", | ||
"authors": [ | ||
"Sajera: Serhii P <allsajera@gmail.com>" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sajera/s-uid.git" | ||
}, | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": {} | ||
} | ||
"name": "s-uid", | ||
"main": "s-uid.min.js", | ||
"private": false, | ||
"description": "Generate id from base string", | ||
"ignore": [ | ||
"node_modules", | ||
"bower_components", | ||
"package.json", | ||
"bower.json", | ||
"gulpfile.js", | ||
"lib", | ||
"test.*" | ||
], | ||
"keywords": [ | ||
"s-uid", | ||
"uid" | ||
], | ||
"homepage": "https://github.com/sajera/s-uid", | ||
"authors": [ | ||
"Sajera: Serhii P <allsajera@gmail.com>" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sajera/s-uid.git" | ||
}, | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": {} | ||
} |
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,146 @@ | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
|
||
## uid | ||
|
||
generate random id based on template string. | ||
Default template string is 'xxxxxxxx-xxxx-1xxx-1xxx-xxxxxxxxxxxx'. | ||
|
||
> Template rules very simple: | ||
> | ||
> **base** - it's a string for creating id. Rewrite only special characters | ||
> | ||
> **N** - Rewrite to random Number | ||
> | ||
> **H** - Rewrite to random hex numder | ||
> | ||
> **S** - Rewrite to random english symbol | ||
> | ||
> **X** - Rewrite to any from "N","H","S" | ||
**Parameters** | ||
|
||
- `base` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** :[default: 'XXXXXXXX-XXXX-1XXX-1XXX-XXXXXXXXXXXX'] | ||
|
||
**Examples** | ||
|
||
```javascript | ||
uid(); | ||
uid('XXX-4NNN-dummy-SSS'); | ||
``` | ||
|
||
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
|
||
## uid.\_time | ||
|
||
Humanized time string. | ||
This method is very sensitive to the correctness of the input arguments | ||
|
||
**Parameters** | ||
|
||
- `separator` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Separator character for output | ||
- `date` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** instance of Date constructor | ||
|
||
**Examples** | ||
|
||
```javascript | ||
uid._time('-', new Date() ); | ||
``` | ||
|
||
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
|
||
## uid.\_date | ||
|
||
Humanized date string. | ||
This method is very sensitive to the correctness of the input arguments | ||
|
||
**Parameters** | ||
|
||
- `separator` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Separator character for output | ||
- `date` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** instance of Date constructor | ||
|
||
**Examples** | ||
|
||
```javascript | ||
uid._date('-', new Date() ); | ||
``` | ||
|
||
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
|
||
## uid.time | ||
|
||
Humanized date+time string. Safe method. | ||
|
||
**Parameters** | ||
|
||
- `date` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** :[default: new Date()] - instance of Date constructor | ||
- `separator1` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** :[default: ' - '] - Separator character for output date | ||
- `separator2` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** :[default: ' \s '] - Separator character for output bitwin date and time | ||
- `separator3` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** :[default: ' : '] - Separator character for output time | ||
- `time` | ||
|
||
**Examples** | ||
|
||
```javascript | ||
uid.time(); | ||
uid.time( new Date() ); | ||
uid.time( new Date(), '-', ':', '-'); | ||
``` | ||
|
||
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
|
||
## uid.th | ||
|
||
hash based on time in 36 numerical system by default | ||
|
||
**Parameters** | ||
|
||
- `date` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** :[default: new Date()] - instance of Date constructor | ||
- `Number` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** [bit]:[default: 36] - expect number 2-36 | ||
|
||
**Examples** | ||
|
||
```javascript | ||
uid.th(); | ||
uid.th(null, 4); | ||
uid.th(new Date(), 10); | ||
``` | ||
|
||
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** hash string | ||
|
||
## uid.guid | ||
|
||
generate uuid (xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx) | ||
based on time, reserved characters and random symbols | ||
|
||
**Parameters** | ||
|
||
- `M` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** [default: random english symbol ( uid('S') )] | ||
- `N` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** [default: random number ( uid('N') )] | ||
- `time` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** [default: new Date()] - date of guid generation | ||
|
||
**Examples** | ||
|
||
```javascript | ||
uid.guid(); | ||
uid.guid('M', 0, new Date() ); | ||
``` | ||
|
||
Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
|
||
## exports | ||
|
||
defination on platforms (both variants on platform like Electron) | ||
|
||
bower i --save s-uid | ||
|
||
npm i --save s-uid | ||
|
||
**Examples** | ||
|
||
```javascript | ||
window.uid || window['s-uid'] // in browser | ||
``` | ||
|
||
```javascript | ||
var uid = require('s-uid') // in Node.js | ||
``` |
Oops, something went wrong.