documentation, update eslint, copyright

This commit is contained in:
Timo Hocker 2020-05-15 12:18:37 +02:00
parent 9551f1b354
commit 15f41cbb62
12 changed files with 85 additions and 20 deletions

View File

@ -1 +1,2 @@
*.d.ts *.d.ts
jenkins.js

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (C) Sapphirecode - All Rights Reserved * Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of Utilities which is released under MIT. * This file is part of utilities which is released under MIT.
* See file 'LICENSE' for full license details. * See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@sapphirecode.ovh>, March 2020 * Created by Timo Hocker <timo@scode.ovh>, May 2020
*/ */
module.exports = { module.exports = {

8
.liconfig.json Normal file
View File

@ -0,0 +1,8 @@
{
"has_license": true,
"license": "MIT",
"author": "Timo Hocker",
"company": "Sapphirecode",
"email": "timo@scode.ovh",
"software": "utilities"
}

2
Jenkinsfile vendored
View File

@ -5,7 +5,7 @@ pipeline {
VERSION = VersionNumber([ VERSION = VersionNumber([
versionNumberString: versionNumberString:
'${BUILDS_ALL_TIME}', '${BUILDS_ALL_TIME}',
versionPrefix: '1.0.', versionPrefix: '1.3.',
worstResultForIncrement: 'SUCCESS' worstResultForIncrement: 'SUCCESS'
]) ])
} }

7
LICENSE Normal file
View File

@ -0,0 +1,7 @@
MIT License Copyright (c) <year> <author>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,9 +1,23 @@
# Utilities # @sapphirecode/utilities
General helper functions version: 1.3.x
small utility functions to make much needed features easier to work with
## Installation
npm:
> npm i --save @sapphirecode/utilities
yarn:
> yarn add @sapphirecode/utilities
## Usage
```js ```js
const util = require('@scode/utilities'); const util = require('@sapphirecode/utilities');
// cut off decimal places to a specified point // cut off decimal places to a specified point
util.truncate_decimal(12.345678, 2); util.truncate_decimal(12.345678, 2);
@ -24,4 +38,15 @@ const regex = /foo/g;
util.run_regex(regex, data, res => { util.run_regex(regex, data, res => {
console.log(res[0]); // will output 'foo' 2 times console.log(res[0]); // will output 'foo' 2 times
}); });
// check if a variable is null, undefined or NaN
console.log(util.is_nil(parseInt('abc'))); // true
console.log(util.is_nil('foo')); // false
console.log(util.is_nil(42)); // false
console.log(util.is_nil(null)); // true
console.log(util.is_nil(undefined)); // true
``` ```
## License
MIT © Timo Hocker <timo@scode.ovh>

7
index.d.ts vendored
View File

@ -1,3 +1,10 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of utilities which is released under MIT.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, May 2020
*/
/** /**
* truncates a floating point number * truncates a floating point number
* *

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (C) Sapphirecode - All Rights Reserved * Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of Utilities which is released under MIT. * This file is part of utilities which is released under MIT.
* See file 'LICENSE' for full license details. * See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@sapphirecode.ovh>, March 2020 * Created by Timo Hocker <timo@scode.ovh>, May 2020
*/ */
'use strict'; 'use strict';

View File

@ -1,3 +1,10 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of utilities which is released under MIT.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, May 2020
*/
/* eslint-disable */ /* eslint-disable */
'use strict'; 'use strict';

View File

@ -2,15 +2,25 @@
"name": "@sapphirecode/utilities", "name": "@sapphirecode/utilities",
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"author": "Timo Hocker <t-hocker@web.de>", "author": "Timo Hocker <timo@scode.ovh>",
"license": "MIT", "license": "MIT",
"keywords": [
"utilities",
"regex",
"json"
],
"repository": {
"type": "git",
"url": "git@git.scode.ovh:timo/utilities"
},
"description": "small utility functions to make much needed features easier to work with",
"devDependencies": { "devDependencies": {
"@sapphirecode/eslint-config": "^2.0.2", "@sapphirecode/eslint-config": "^2.1.3",
"@stryker-mutator/core": "^3.0.2", "@stryker-mutator/core": "^3.2.1",
"@stryker-mutator/javascript-mutator": "^3.0.2", "@stryker-mutator/javascript-mutator": "^3.2.1",
"ava": "^3.5.0", "ava": "^3.8.2",
"eslint": "^6.8.0", "eslint": "^7.0.0",
"nyc": "^15.0.0" "nyc": "^15.0.1"
}, },
"scripts": { "scripts": {
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs", "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs",

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (C) Sapphirecode - All Rights Reserved * Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of Utilities which is released under MIT. * This file is part of utilities which is released under MIT.
* See file 'LICENSE' for full license details. * See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@sapphirecode.ovh>, March 2020 * Created by Timo Hocker <timo@scode.ovh>, May 2020
*/ */
'use strict'; 'use strict';

View File

@ -1,8 +1,8 @@
/* /*
* Copyright (C) Sapphirecode - All Rights Reserved * Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of Utilities which is released under MIT. * This file is part of utilities which is released under MIT.
* See file 'LICENSE' for full license details. * See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, March 2020 * Created by Timo Hocker <timo@scode.ovh>, May 2020
*/ */
/* eslint-disable no-magic-numbers */ /* eslint-disable no-magic-numbers */