Skip to content

Commit

Permalink
Merge cef0b62 into 5d5adbc
Browse files Browse the repository at this point in the history
  • Loading branch information
heyjul3s committed Feb 10, 2021
2 parents 5d5adbc + cef0b62 commit 2251749
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 21 deletions.
14 changes: 0 additions & 14 deletions packages/imagery/__tests__/utils/string.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import * as utils from '../../src/utils/string';

describe('string', () => {
describe('isString', () => {
it('should return FALSE when provided with a non-string type value', () => {
expect(utils.isString({} as any)).toBe(false);
expect(utils.isString(void 0 as any)).toBe(false);
expect(utils.isString(null as any)).toBe(false);
expect(utils.isString(false as any)).toBe(false);
expect(utils.isString(NaN as any)).toBe(false);
});

it('isString', () => {
expect(utils.isString('1')).toBe(true);
});
});

describe('isNonEmptyString', () => {
it('should return FALSE when provided with a non-string argument', () => {
expect(utils.isNonEmptyString({} as any)).toBe(false);
Expand Down
1 change: 1 addition & 0 deletions packages/imagery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"styled-components": ">=5.2.1"
},
"dependencies": {
"@annexe/isstring": "^0.1.0",
"@artifak/component-generator": "^2.0.1"
}
}
4 changes: 1 addition & 3 deletions packages/imagery/src/utils/string.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export function isString(arg: unknown): boolean {
return Object.prototype.toString.call(arg) === '[object String]';
}
import { isString } from '@annexe/isstring';

export function isNonEmptyString(arg?: string): boolean {
return isString(arg) && !!arg?.trim();
Expand Down
1 change: 1 addition & 0 deletions packages/media/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"styled-components": ">=5.2.1"
},
"dependencies": {
"@annexe/isstring": "^0.1.0",
"lodash.isempty": "^4.4.0",
"lodash.isplainobject": "^4.0.6"
}
Expand Down
4 changes: 1 addition & 3 deletions packages/media/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export function isString(arg: unknown): boolean {
return Object.prototype.toString.call(arg) === '[object String]';
}
import { isString } from '@annexe/isstring';

export function isNonEmptyString(arg?: unknown): boolean {
return isString(arg) && (arg as string).trim() !== '';
Expand Down
3 changes: 3 additions & 0 deletions packages/pxtoem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
"homepage": "https://github.com/heyjul3s/artifak#readme",
"devDependencies": {
"@artifak/bundler": "^1.1.3"
},
"dependencies": {
"@annexe/isstring": "^0.1.0"
}
}
4 changes: 3 additions & 1 deletion packages/pxtoem/src/pxtoem.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { isString } from '@annexe/isstring';

export function pxToEm(size: number | string, baseSize = 16): string {
const pxValue = getPxNumericValue(size);
return `${pxValue / baseSize}em`;
}

export function getPxNumericValue(size: number | string): number {
if (Object.prototype.toString.call(size) === '[object String]') {
if (isString(size)) {
return extractPxNumericValue(size as string);
}

Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# yarn lockfile v1


"@annexe/isstring@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@annexe/isstring/-/isstring-0.1.0.tgz#861ea69d394a9c9e69b4ee6a6a60fa39c2d93ec9"
integrity sha512-Q7IZqRaUOqKnuO3gFvIg8mmr41K/NA5ef8Xz6QMYNFZw/hv03srnnHoVYuP2RonEH1s41m9fhAt2qMsCagAmlA==

"@babel/code-frame@7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e"
Expand Down

0 comments on commit 2251749

Please sign in to comment.