Comparing version 0.2.1 to 0.2.2
@@ -10,2 +10,8 @@ # Changelog | ||
## [0.2.2] - 2018-06-11 | ||
### Fixed | ||
- Fix util methods `padStart()` and `padEnd()`. (1ded7bb88e1712fe5b60801aca29a5df44a4ecbc) | ||
## [0.2.0] - 2018-05-16 | ||
@@ -46,3 +52,4 @@ | ||
[Unreleased]: https://github.com/archco/moo-color/compare/v0.2.0...HEAD | ||
[Unreleased]: https://github.com/archco/moo-color/compare/v0.2.2...HEAD | ||
[0.2.2]: https://github.com/archco/moo-color/compare/v0.2.0...v0.2.2 | ||
[0.2.0]: https://github.com/archco/moo-color/compare/v0.1.3...v0.2.0 | ||
@@ -49,0 +56,0 @@ [0.1.3]: https://github.com/archco/moo-color/compare/v0.1.1...v0.1.3 |
@@ -1340,3 +1340,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
} | ||
return chars.length > limit ? chars.substring(chars.length - limit) : chars; | ||
return chars.substring(0, limit); | ||
} | ||
@@ -1343,0 +1343,0 @@ function clamp(num, min, max) { |
@@ -29,2 +29,2 @@ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.MooColor=e():t.MooColor=e()}(this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s="./src/moo-color.ts")}({"./node_modules/color-name/index.js": | ||
\**************************/ | ||
/*! exports provided: padStart, padEnd, clamp, degree, resolveAlpha, decimal, getRandom, arrayIsEqual */function(t,e,r){"use strict";function n(t,e,r){var n=e-t.length;return n>0?""+a(r,n)+t:t}function o(t,e,r){var n=e-t.length;return n>0?""+t+a(r,n):t}function a(t,e){for(;t.length<e;)t+=t;return t.length>e?t.substring(t.length-e):t}function u(t,e,r){return Math.min(Math.max(e,t),r)}function s(t){return((t="string"==typeof t?parseFloat(t):t)%360+360)%360}function c(t){return t="string"==typeof t?parseFloat(t):t,u(isNaN(t)?1:t,0,1)}function i(t,e){var r=Math.pow(10,e);return Math.round(t*r)/r}function l(t,e,r){return void 0===r&&(r=0),i(Math.random()*(e-t)+t,r)}function h(t,e){return t.length===e.length&&t.every(function(t,r){return Array.isArray(t)?h(t,e[r]):t===e[r]})}r.r(e),r.d(e,"padStart",function(){return n}),r.d(e,"padEnd",function(){return o}),r.d(e,"clamp",function(){return u}),r.d(e,"degree",function(){return s}),r.d(e,"resolveAlpha",function(){return c}),r.d(e,"decimal",function(){return i}),r.d(e,"getRandom",function(){return l}),r.d(e,"arrayIsEqual",function(){return h})}})}); | ||
/*! exports provided: padStart, padEnd, clamp, degree, resolveAlpha, decimal, getRandom, arrayIsEqual */function(t,e,r){"use strict";function n(t,e,r){var n=e-t.length;return n>0?""+a(r,n)+t:t}function o(t,e,r){var n=e-t.length;return n>0?""+t+a(r,n):t}function a(t,e){for(;t.length<e;)t+=t;return t.substring(0,e)}function u(t,e,r){return Math.min(Math.max(e,t),r)}function s(t){return((t="string"==typeof t?parseFloat(t):t)%360+360)%360}function c(t){return t="string"==typeof t?parseFloat(t):t,u(isNaN(t)?1:t,0,1)}function i(t,e){var r=Math.pow(10,e);return Math.round(t*r)/r}function l(t,e,r){return void 0===r&&(r=0),i(Math.random()*(e-t)+t,r)}function h(t,e){return t.length===e.length&&t.every(function(t,r){return Array.isArray(t)?h(t,e[r]):t===e[r]})}r.r(e),r.d(e,"padStart",function(){return n}),r.d(e,"padEnd",function(){return o}),r.d(e,"clamp",function(){return u}),r.d(e,"degree",function(){return s}),r.d(e,"resolveAlpha",function(){return c}),r.d(e,"decimal",function(){return i}),r.d(e,"getRandom",function(){return l}),r.d(e,"arrayIsEqual",function(){return h})}})}); |
{ | ||
"name": "moo-color", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A simple color library.", | ||
@@ -5,0 +5,0 @@ "main": "dist/moo-color.js", |
@@ -15,3 +15,3 @@ export function padStart(str: string, length: number, chars: string): string { | ||
} | ||
return chars.length > limit ? chars.substring(chars.length - limit) : chars; | ||
return chars.substring(0, limit); | ||
} | ||
@@ -18,0 +18,0 @@ |
@@ -10,7 +10,6 @@ import { | ||
describe('#padStart', () => { | ||
it('padStart', () => { | ||
let res = padStart('xx', 4, 'O'); | ||
expect(res).toEqual('OOxx'); | ||
res = padStart('xx', 8, '12'); | ||
expect(res).toEqual('121212xx'); | ||
it('should works.', () => { | ||
expect(padStart('abc', 5, '0')).toEqual('00abc'); | ||
expect(padStart('abcdef', 4, '0')).toEqual('abcdef'); | ||
expect(padStart('abc', 10, '123')).toEqual('1231231abc'); | ||
}); | ||
@@ -20,13 +19,7 @@ }); | ||
describe('#padEnd', () => { | ||
it('padEnd', () => { | ||
let res = padEnd('4', 4, '-'); | ||
expect(res).toEqual('4---'); | ||
res = padEnd('xx', 8, '123'); | ||
expect(res).toEqual('xx123123'); | ||
it('should works.', () => { | ||
expect(padEnd('abc', 5, '0')).toEqual('abc00'); | ||
expect(padEnd('abcdef', 4, '0')).toEqual('abcdef'); | ||
expect(padEnd('abc', 10, '123')).toEqual('abc1231231'); | ||
}); | ||
it('no space, no change.', () => { | ||
const str = padEnd('1234', 4, '_'); | ||
expect(str).toEqual('1234'); | ||
}); | ||
}); | ||
@@ -33,0 +26,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
227096
3383