Skip to content

Commit

Permalink
Merge pull request #1 from codepress/develop
Browse files Browse the repository at this point in the history
1.0.1
  • Loading branch information
DGStefan authored Dec 11, 2018
2 parents c74986f + e7509d9 commit 3dcdbd1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
7 changes: 5 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
= NEWVERSION =
Release Date: November 2nd, 2018
= 1.0.1 =
Release Date: December 11th, 2018

- Added String.Format Helper
- Added String.IsFloat Helper
- Added Polyfill: CustomEvent
- Added Polyfill: Nodelist

= 1.0 =
Release Date: November 2nd, 2018
Expand Down
30 changes: 30 additions & 0 deletions helper/strings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
/**
* Return a pixel string -> 4px
*
* @param number
* @returns {string}
*/
export function toPixel( number ) {
return number + 'px';
}

/**
* Javascript version of sprintf
*
* Usage: Format( '{0} is {1}', 'ES6', 'Awesome' );
*
* @param {String} format
* @returns {*}
*/
export function Format( format ) {
let args = Array.prototype.slice.call( arguments, 1 );
return format.replace( /{(\d+)}/g, function( match, number ) {
return typeof args[ number ] !== 'undefined'
? args[ number ]
: match
;
} );
}

export function isFloat( value, decimal_point_regex ) {
let regex = new RegExp( "^[0-9]+((\." + decimal_point_regex + ")[0-9]+)?$" );

return value.match( regex );
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "admin-columns-js",
"version": "1.0.0",
"version": "1.0.1",
"repository": {
"type": "git",
"url": "https://github.com/codepress/admin-columns-js.git"
Expand Down

0 comments on commit 3dcdbd1

Please sign in to comment.