Skip to content

Commit

Permalink
Release V1.2.0 (#13)
Browse files Browse the repository at this point in the history
* auto capitalize function

* currency format common function

* initial commit

* added more util functions

* added currency formatter

* documentation

* added date and common utils

* add documentation also revise the functionality of function

* removed redundant currency and capitalize files

* validations for data types in all methods

* removed else statements

* slight change

* added more utils

* Release V1.1.0

* Config issue (#11)

* Bump lodash from 4.17.15 to 4.17.19

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <[email protected]>

* Release V1.2.0 (#9)

* auto capitalize function

* currency format common function

* initial commit

* added more util functions

* added currency formatter

* documentation

* added date and common utils

* add documentation also revise the functionality of function

* removed redundant currency and capitalize files

* validations for data types in all methods

* removed else statements

* slight change

* added more utils

* Release V1.1.0

Co-authored-by: vikrantrana1337 <[email protected]>
Co-authored-by: eklavyagehlaut <[email protected]>
Co-authored-by: pavan_bharatpe <[email protected]>
Co-authored-by: krishcdbry <[email protected]>

* Bump elliptic from 6.5.2 to 6.5.3 (#10)

Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](indutny/elliptic@v6.5.2...v6.5.3)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* config changes

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: krishpe <[email protected]>
Co-authored-by: vikrantrana1337 <[email protected]>
Co-authored-by: eklavyagehlaut <[email protected]>
Co-authored-by: krishcdbry <[email protected]>
Co-authored-by: Pavan Kumar Patruni <[email protected]>

* isIOS valiation check added (#12)

* isIOS valiation check added

* Minor fixes

Co-authored-by: krishcdbry <[email protected]>

Co-authored-by: vikrantrana1337 <[email protected]>
Co-authored-by: eklavyagehlaut <[email protected]>
Co-authored-by: pavan_bharatpe <[email protected]>
Co-authored-by: krishcdbry <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pavan Kumar Patruni <[email protected]>
  • Loading branch information
7 people authored Aug 21, 2020
1 parent 73a887b commit 67ef187
Show file tree
Hide file tree
Showing 13 changed files with 1,146 additions and 1,131 deletions.
15 changes: 11 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"presets": ["env"],
"plugins": [
"transform-object-rest-spread"
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
}
}
]
]
}
}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ npm i utileo --save-dev
isArray | value | Check for an Array
isObject | value | Check for an Object
isFunction | value | Check for a function
isIOS | none | Check device type is IOS or not


## Storage Util Methods

Expand Down
2 changes: 1 addition & 1 deletion dist/lib.js

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "utileo",
"version": "1.1.0",
"version": "1.2.0",
"description": "JS library with most common utils.",
"main": "dist/lib.js",
"module": "dist/lib.js",
Expand All @@ -10,26 +10,20 @@
"lint:fix": "eslint --fix src/."
},
"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^7.1.5",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"eslint": "^6.8.0",
"eslint-plugin-import": "^2.20.2",
"uglifyjs-webpack-plugin": "^2.2.0",
"terser-webpack-plugin": "^4.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
},
"author": "WebChapter | Bharatpe",
"license": "ISC",
"dependencies": {
"history": "^5.0.0",
"terser-webpack-plugin": "^3.0.3"
"history": "^5.0.0"
}
}
49 changes: 35 additions & 14 deletions src/CommonUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const ONLY_APLHABETS_REGEX = /^[A-Za-z ]+$/;
const ONLY_NUMBER_REGEX = /^[0-9\b]+$/;

/**
* @function _validateName
* @name _validateName
* @param {string} str
* @description Check if all character in the string are alphabets
*/
Expand All @@ -14,7 +14,7 @@ const _validateName = str => {
};

/**
* @function _validateOnlyNumber
* @name _validateOnlyNumber
* @param {string,number} str
* @description Check if it is a number
*/
Expand All @@ -26,7 +26,7 @@ const _validateOnlyNumber = str => {
};

/**
* @function _titleCase
* @name _titleCase
* @param {string} str
* @description convert a string to title case
*/
Expand All @@ -40,7 +40,7 @@ const _titleCase = str => {
};

/**
* @function _camelize
* @name _camelize
* @param {string} str
* @description Converting hello-world style strings to helloWorld style strings
*/
Expand All @@ -53,7 +53,7 @@ const _camelize = str => {
};

/**
* @function _removeSpacesAndLowerCase
* @name _removeSpacesAndLowerCase
* @param {string} str
* @description Converting to lower case and remove spaces in a string
*/
Expand All @@ -65,7 +65,7 @@ const _removeSpacesAndLowerCase = str => {
};

/**
* @function _replaceSpaceWithUnderscore
* @name _replaceSpaceWithUnderscore
* @param {string} str
* @description Converting space to underscore in a string
*/
Expand All @@ -77,7 +77,7 @@ const _replaceSpaceWithUnderscore = str => {
};

/**
* @function _replaceSpecialCharsWithUnderscore
* @name _replaceSpecialCharsWithUnderscore
* @param {string} str
* @description Replace special chars like @,$ to _
*/
Expand All @@ -89,7 +89,7 @@ const _replaceSpecialCharsWithUnderscore = str => {
};

/**
* @function _addKeyToObject
* @name _addKeyToObject
* @param {*} object
* @description Add type key to objects
*/
Expand All @@ -109,7 +109,7 @@ const _addKeyToObject = object => {
};

/**
* @function _getIndex
* @name _getIndex
* @param {Array} inputArr
* @param {Object} needleObj
* @description Returns index of needleObj in an array of objects inputArr
Expand All @@ -135,7 +135,7 @@ const _getIndex = (inputArr, needleObj) => {
}

/**
* @function _toNumber
* @name _toNumber
* @param {string} value
* @description convert a string to number
*/
Expand All @@ -147,7 +147,7 @@ const _toNumber = value => {
};

/**
* @function _partition
* @name _partition
* @param {array} arr
* @param {function} criteria
* @description splits an array into two groups - one that match criteria and one that don't
Expand All @@ -167,7 +167,7 @@ var _partition = function (arr, criteria) {
};

/**
* @function _isArray
* @name _isArray
* @param {*} arr
* @description Check for an Array
*/
Expand All @@ -176,7 +176,7 @@ const _isArray = arr => {
};

/**
* @function _isObject
* @name _isObject
* @param {*} obj
* @description Check for an Object
*/
Expand All @@ -185,14 +185,34 @@ const _isObject = obj => {
};

/**
* @function _isFunction
* @name _isFunction
* @param {*} func
* @description Check for a function
*/
const _isFunction = func => {
return typeof func === 'function';
};

/*
* @name isIOS
* @description To check the device is IOS or not
* @return {boolean}
*/
const _isIOS = () => {
return (
[
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod',
].includes(navigator.platform) ||
// iPad on iOS 13 detection
(navigator.userAgent.includes('Mac') && 'ontouchend' in document)
);
};

export default {
validateName: _validateName,
validateOnlyNumber: _validateOnlyNumber,
Expand All @@ -208,4 +228,5 @@ export default {
isArray: _isArray,
isObject: _isObject,
isFunction: _isFunction,
isIOS: _isIOS,
};
12 changes: 6 additions & 6 deletions src/StorageUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let StorageMap = {};

/**
* @function strToJson
* @name strToJson
* @param {string} str
* @description string to JSON object conversation
*/
Expand All @@ -17,7 +17,7 @@ const strToJson = (str) => {
}

/**
* @function _get
* @name _get
* @param {string} key
* @description get value from localstorage by key name
*/
Expand All @@ -28,7 +28,7 @@ const _get = (key) => {
}

/**
* @function _set
* @name _set
* @param {string} key
* @param {string} value
* @description set value to localstorage
Expand All @@ -45,7 +45,7 @@ const _set = (key, value) => {
}

/**
* @function _has
* @name _has
* @param {string} key
* @description check key available in localstorage
*/
Expand All @@ -54,7 +54,7 @@ const _has = (key) => {
}

/**
* @function _remove
* @name _remove
* @param {string} key
* @description remove key from localstorage
*/
Expand All @@ -64,7 +64,7 @@ const _remove = (key) => {
}

/**
* @function _removeAll
* @name _removeAll
* @description remove all items from localstorage
*/
const _removeAll = () => {
Expand Down
25 changes: 25 additions & 0 deletions src/UrlParse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @name _getURLParameter
* @param {string} qrString
* @param {string} paramName
* @description get value of param from URL
*/
const _getURLParameter = (qrString, paramName) => {
if (typeof qrString === "string" && typeof paramName === "string") {
qrString = qrString.replace(/[\[]/,'\\[').replace(/[\]]/,'\\]');
var regex = new RegExp('[\\?&]' + paramName + '=([^&#]*)');
var results = regex.exec(qrString);


if (results && results.length > 0) {
return decodeURIComponent(results[1].replace(/\+/g, ' '));
} else {
return '';
}
}
return '';
}

export default {
getURLParameter: _getURLParameter,
};
2 changes: 1 addition & 1 deletion src/geolocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function getCurrentLatLong(timeout) {
}

/**
* @function _getLatLong
* @name _getLatLong
* @param {number} timeout
* @description get lat and long
*/
Expand Down
1 change: 1 addition & 0 deletions src/history.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createHashHistory } from 'history';

const history = createHashHistory();
// eslint-disable-next-line no-unused-vars
history.listen(_ => {
window.scrollTo(0, 0)
})
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import StorageUtils from './StorageUtils';
import DateUtils from './DateUtils';
import CommonUtils from './CommonUtils';
import History from './history';
import URLUtils from './urlParameter';
import GeoLocationUtils from './geolocation';
import History from './History';
import URLUtils from './UrlParse';
import GeoLocationUtils from './Geolocation';
import CurrencyUtils from './CurrencyUtils';

export {
Expand Down
26 changes: 13 additions & 13 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
// const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin')

// eslint-disable-next-line no-undef
Expand All @@ -11,12 +11,12 @@ module.exports = {
module : {
rules : [
{
test : /\.js$/,
// eslint-disable-next-line no-undef
include : path.resolve(__dirname, 'src'),
test: /\.js$/,
exclude: /node_modules/,
loaders : 'babel-loader'
}
use: {
loader: 'babel-loader',
},
},
]
},
output : {
Expand All @@ -28,14 +28,14 @@ module.exports = {
},
plugins: [
new CleanWebpackPlugin(),
new TerserPlugin({
parallel: true,
terserOptions: {
ecma: 6,
},
})
// new UglifyJsPlugin()
],
optimization: {
minimizer: [new UglifyJsPlugin()],
minimizer: [new TerserPlugin({
parallel: true,
terserOptions: {
ecma: 6,
},
})],
},
}
Loading

0 comments on commit 67ef187

Please sign in to comment.