@daybrush/utils
Advanced tools
Comparing version 0.4.0 to 0.4.1
const pkg = require("../package.json"); | ||
module.exports = `/* | ||
Copyright (c) 2018 ${pkg.author} | ||
@name: ${pkg.name} | ||
license: ${pkg.license} | ||
@@ -5,0 +6,0 @@ author: ${pkg.author} |
@@ -1,2 +0,2 @@ | ||
export interface ObjectInterface<T> { | ||
export interface IObject<T> { | ||
[name: string]: T; | ||
@@ -3,0 +3,0 @@ } |
@@ -1,5 +0,5 @@ | ||
import { ObjectInterface } from "./consts"; | ||
import { IObject } from "./consts"; | ||
export declare function hasClass(element: HTMLElement, className: string): boolean; | ||
export declare function addClass(element: HTMLElement, className: string): void; | ||
export declare function removeClass(element: HTMLElement, className: string): void; | ||
export declare function fromCSS(elements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>, properties: string[]): ObjectInterface<any>; | ||
export declare function fromCSS(elements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>, properties: string[]): IObject<any>; |
@@ -1,4 +0,4 @@ | ||
import { ObjectInterface } from "./consts"; | ||
import { IObject } from "./consts"; | ||
export declare function isUndefined(value: any): value is undefined; | ||
export declare function isObject(value: any): value is ObjectInterface<any>; | ||
export declare function isObject(value: any): value is IObject<any>; | ||
export declare function isArray(value: any): value is any[]; | ||
@@ -5,0 +5,0 @@ export declare function isString(value: any): value is string; |
/* | ||
Copyright (c) 2018 Daybrush | ||
@name: @daybrush/utils | ||
license: MIT | ||
author: Daybrush | ||
repository: https://github.com/daybrush/utils | ||
@version 0.4.0 | ||
@version 0.4.1 | ||
*/ | ||
@@ -260,3 +261,3 @@ /** | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -278,3 +279,3 @@ import {isObject} from "@daybrush/utils"; | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -296,3 +297,3 @@ import {isArray} from "@daybrush/utils"; | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -314,3 +315,3 @@ import {isString} from "@daybrush/utils"; | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -401,3 +402,3 @@ import {isFunction} from "@daybrush/utils"; | ||
* @param {string} text - text to divide | ||
* @return {object} divided texts | ||
* @return {} divided texts | ||
* @example | ||
@@ -523,4 +524,4 @@ import {splitUnit} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {string} hex - hex color | ||
* @return {string} hex color | ||
* @param {} hex - hex color | ||
* @return {} hex color | ||
* @example | ||
@@ -538,4 +539,4 @@ import {cutHex} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {String} hex - hex color | ||
* @return {Array} rgb color | ||
* @param {} hex - hex color | ||
* @return {} rgb color | ||
* @example | ||
@@ -566,4 +567,4 @@ import {hexToRGBA} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {String} hex - 3(or 4)-digit hex color | ||
* @return {String} 6(or 8)-digit hex color | ||
* @param {} hex - 3(or 4)-digit hex color | ||
* @return {} 6(or 8)-digit hex color | ||
* @example | ||
@@ -587,4 +588,4 @@ import {toFullHex} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {Array} hsl(a) - hsl color(hue: 0 ~ 360, saturation: 0 ~ 1, lightness: 0 ~ 1, alpha: 0 ~ 1) | ||
* @return {Array} rgba color | ||
* @param {} hsl - hsl color(hue: 0 ~ 360, saturation: 0 ~ 1, lightness: 0 ~ 1, alpha: 0 ~ 1) | ||
* @return {} rgba color | ||
* @example | ||
@@ -632,4 +633,4 @@ import {hslToRGBA} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {String} - 3-hex(#000), 4-hex(#0000) 6-hex(#000000), 8-hex(#00000000) or RGB(A), or HSL(A) | ||
* @return {Array} rgba color | ||
* @param {} - 3-hex(#000), 4-hex(#0000) 6-hex(#000000), 8-hex(#00000000) or RGB(A), or HSL(A) | ||
* @return {} rgba color | ||
* @example | ||
@@ -698,4 +699,4 @@ import {stringToRGBA} from "@daybrush/utils"; | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to search | ||
* @param element - target | ||
* @param className - the class name to search | ||
* @return {boolean} return false if the class is not found. | ||
@@ -717,4 +718,4 @@ * @example | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to add | ||
* @param element - target | ||
* @param className - the class name to add | ||
* @example | ||
@@ -736,4 +737,4 @@ import {addClass} from "@daybrush/utils"; | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to remove | ||
* @param element - target | ||
* @param className - the class name to remove | ||
* @example | ||
@@ -756,5 +757,5 @@ import {removeClass} from "@daybrush/utils"; | ||
* @memberof DOM | ||
* @param {HTMLElement | HTMLElement[]} elements - elements | ||
* @param {string[]} properites - the CSS properties | ||
* @return {object} returns CSS properties and values. | ||
* @param elements - elements | ||
* @param properites - the CSS properties | ||
* @return returns CSS properties and values. | ||
* @example | ||
@@ -761,0 +762,0 @@ import {fromCSS} from "@daybrush/utils"; |
/* | ||
Copyright (c) 2018 Daybrush | ||
@name: @daybrush/utils | ||
license: MIT | ||
author: Daybrush | ||
repository: https://github.com/daybrush/utils | ||
@version 0.4.0 | ||
@version 0.4.1 | ||
*/ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.utils = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.utils = factory()); | ||
}(this, (function () { 'use strict'; | ||
@@ -266,3 +267,3 @@ /** | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -284,3 +285,3 @@ import {isObject} from "@daybrush/utils"; | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -302,3 +303,3 @@ import {isArray} from "@daybrush/utils"; | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -320,3 +321,3 @@ import {isString} from "@daybrush/utils"; | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -407,3 +408,3 @@ import {isFunction} from "@daybrush/utils"; | ||
* @param {string} text - text to divide | ||
* @return {object} divided texts | ||
* @return {} divided texts | ||
* @example | ||
@@ -529,4 +530,4 @@ import {splitUnit} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {string} hex - hex color | ||
* @return {string} hex color | ||
* @param {} hex - hex color | ||
* @return {} hex color | ||
* @example | ||
@@ -544,4 +545,4 @@ import {cutHex} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {String} hex - hex color | ||
* @return {Array} rgb color | ||
* @param {} hex - hex color | ||
* @return {} rgb color | ||
* @example | ||
@@ -572,4 +573,4 @@ import {hexToRGBA} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {String} hex - 3(or 4)-digit hex color | ||
* @return {String} 6(or 8)-digit hex color | ||
* @param {} hex - 3(or 4)-digit hex color | ||
* @return {} 6(or 8)-digit hex color | ||
* @example | ||
@@ -593,4 +594,4 @@ import {toFullHex} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {Array} hsl(a) - hsl color(hue: 0 ~ 360, saturation: 0 ~ 1, lightness: 0 ~ 1, alpha: 0 ~ 1) | ||
* @return {Array} rgba color | ||
* @param {} hsl - hsl color(hue: 0 ~ 360, saturation: 0 ~ 1, lightness: 0 ~ 1, alpha: 0 ~ 1) | ||
* @return {} rgba color | ||
* @example | ||
@@ -638,4 +639,4 @@ import {hslToRGBA} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {String} - 3-hex(#000), 4-hex(#0000) 6-hex(#000000), 8-hex(#00000000) or RGB(A), or HSL(A) | ||
* @return {Array} rgba color | ||
* @param {} - 3-hex(#000), 4-hex(#0000) 6-hex(#000000), 8-hex(#00000000) or RGB(A), or HSL(A) | ||
* @return {} rgba color | ||
* @example | ||
@@ -704,4 +705,4 @@ import {stringToRGBA} from "@daybrush/utils"; | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to search | ||
* @param element - target | ||
* @param className - the class name to search | ||
* @return {boolean} return false if the class is not found. | ||
@@ -723,4 +724,4 @@ * @example | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to add | ||
* @param element - target | ||
* @param className - the class name to add | ||
* @example | ||
@@ -742,4 +743,4 @@ import {addClass} from "@daybrush/utils"; | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to remove | ||
* @param element - target | ||
* @param className - the class name to remove | ||
* @example | ||
@@ -762,5 +763,5 @@ import {removeClass} from "@daybrush/utils"; | ||
* @memberof DOM | ||
* @param {HTMLElement | HTMLElement[]} elements - elements | ||
* @param {string[]} properites - the CSS properties | ||
* @return {object} returns CSS properties and values. | ||
* @param elements - elements | ||
* @param properites - the CSS properties | ||
* @return returns CSS properties and values. | ||
* @example | ||
@@ -798,44 +799,50 @@ import {fromCSS} from "@daybrush/utils"; | ||
exports.RGB = RGB; | ||
exports.RGBA = RGBA; | ||
exports.HSL = HSL; | ||
exports.HSLA = HSLA; | ||
exports.COLOR_MODELS = COLOR_MODELS; | ||
exports.FUNCTION = FUNCTION; | ||
exports.PROPERTY = PROPERTY; | ||
exports.ARRAY = ARRAY; | ||
exports.OBJECT = OBJECT; | ||
exports.STRING = STRING; | ||
exports.NUMBER = NUMBER; | ||
exports.UNDEFINED = UNDEFINED; | ||
exports.IS_WINDOW = IS_WINDOW; | ||
exports.getCrossBrowserProperty = getCrossBrowserProperty; | ||
exports.TRANSFORM = TRANSFORM; | ||
exports.FILTER = FILTER; | ||
exports.ANIMATION = ANIMATION; | ||
exports.KEYFRAMES = KEYFRAMES; | ||
exports.cutHex = cutHex; | ||
exports.hexToRGBA = hexToRGBA; | ||
exports.toFullHex = toFullHex; | ||
exports.hslToRGBA = hslToRGBA; | ||
exports.stringToRGBA = stringToRGBA; | ||
exports.isUndefined = isUndefined; | ||
exports.isObject = isObject; | ||
exports.isArray = isArray; | ||
exports.isString = isString; | ||
exports.isFunction = isFunction; | ||
exports.splitSpace = splitSpace; | ||
exports.splitComma = splitComma; | ||
exports.splitBracket = splitBracket; | ||
exports.splitUnit = splitUnit; | ||
exports.camelize = camelize; | ||
exports.decamelize = decamelize; | ||
exports.now = now; | ||
exports.requestAnimationFrame = requestAnimationFrame; | ||
exports.hasClass = hasClass; | ||
exports.addClass = addClass; | ||
exports.removeClass = removeClass; | ||
exports.fromCSS = fromCSS; | ||
var utils = ({ | ||
RGB: RGB, | ||
RGBA: RGBA, | ||
HSL: HSL, | ||
HSLA: HSLA, | ||
COLOR_MODELS: COLOR_MODELS, | ||
FUNCTION: FUNCTION, | ||
PROPERTY: PROPERTY, | ||
ARRAY: ARRAY, | ||
OBJECT: OBJECT, | ||
STRING: STRING, | ||
NUMBER: NUMBER, | ||
UNDEFINED: UNDEFINED, | ||
IS_WINDOW: IS_WINDOW, | ||
getCrossBrowserProperty: getCrossBrowserProperty, | ||
TRANSFORM: TRANSFORM, | ||
FILTER: FILTER, | ||
ANIMATION: ANIMATION, | ||
KEYFRAMES: KEYFRAMES, | ||
cutHex: cutHex, | ||
hexToRGBA: hexToRGBA, | ||
toFullHex: toFullHex, | ||
hslToRGBA: hslToRGBA, | ||
stringToRGBA: stringToRGBA, | ||
isUndefined: isUndefined, | ||
isObject: isObject, | ||
isArray: isArray, | ||
isString: isString, | ||
isFunction: isFunction, | ||
splitSpace: splitSpace, | ||
splitComma: splitComma, | ||
splitBracket: splitBracket, | ||
splitUnit: splitUnit, | ||
camelize: camelize, | ||
decamelize: decamelize, | ||
now: now, | ||
requestAnimationFrame: requestAnimationFrame, | ||
hasClass: hasClass, | ||
addClass: addClass, | ||
removeClass: removeClass, | ||
fromCSS: fromCSS | ||
}); | ||
return utils; | ||
}))); | ||
//# sourceMappingURL=utils.js.map |
@@ -21,3 +21,13 @@ { | ||
"monospaceLinks": false | ||
}, | ||
"docdash": { | ||
"menu": { | ||
"Github repo": { | ||
"href": "https://github.com/daybrush/utils", | ||
"target": "_blank", | ||
"class": "menu-item", | ||
"id": "repository" | ||
} | ||
} | ||
} | ||
} |
{ | ||
"name": "@daybrush/utils", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "utils for daybrush", | ||
@@ -58,4 +58,4 @@ "main": "dist/utils.js", | ||
"devDependencies": { | ||
"@daybrush/jsdoc": "^0.2.1", | ||
"daybrush-jsdoc-template": "^1.3.2", | ||
"@daybrush/jsdoc": "^0.3.0", | ||
"daybrush-jsdoc-template": "^1.5.0", | ||
"gh-pages": "^2.0.1", | ||
@@ -62,0 +62,0 @@ "rollup": "^0.66.6", |
import typescript from 'rollup-plugin-typescript'; | ||
import PrototypeMinify from "rollup-plugin-prototype-minify"; | ||
import { uglify } from "rollup-plugin-uglify"; | ||
import es3 from "rollup-plugin-es3"; | ||
@@ -15,2 +16,15 @@ | ||
}); | ||
const uglifyCode = uglify({ | ||
sourcemap: true, | ||
output: { | ||
comments: function (node, comment) { | ||
var text = comment.value; | ||
var type = comment.type; | ||
if (type === "comment2") { | ||
// multiline comment | ||
return /@name\:\s@daybrush/.test(text); | ||
} | ||
}, | ||
}, | ||
}); | ||
const defaultConfig = { | ||
@@ -38,5 +52,6 @@ plugins: [ | ||
{ | ||
input: 'src/index.ts', | ||
input: 'src/index.umd.ts', | ||
plugins: [es3({sourcemap: true})], | ||
output: { | ||
exports: "default", | ||
format: "umd", | ||
@@ -47,2 +62,12 @@ name: "utils", | ||
}, | ||
{ | ||
input: 'src/index.umd.ts', | ||
plugins: [es3({sourcemap: true}), uglifyCode], | ||
output: { | ||
exports: "default", | ||
format: "umd", | ||
name: "utils", | ||
file: `./dist/utils.min.js`, | ||
}, | ||
}, | ||
].map(entry => merge(defaultConfig, entry, { | ||
@@ -49,0 +74,0 @@ plugins: "append", |
@@ -12,4 +12,4 @@ import { RGB, RGBA, HSL, HSLA } from "./consts"; | ||
* @memberof Color | ||
* @param {string} hex - hex color | ||
* @return {string} hex color | ||
* @param {} hex - hex color | ||
* @return {} hex color | ||
* @example | ||
@@ -26,4 +26,4 @@ import {cutHex} from "@daybrush/utils"; | ||
* @memberof Color | ||
* @param {String} hex - hex color | ||
* @return {Array} rgb color | ||
* @param {} hex - hex color | ||
* @return {} rgb color | ||
* @example | ||
@@ -37,3 +37,3 @@ import {hexToRGBA} from "@daybrush/utils"; | ||
*/ | ||
export function hexToRGBA(hex: string) { | ||
export function hexToRGBA(hex: string): number[] { | ||
const h = cutHex(hex); | ||
@@ -54,4 +54,4 @@ const r = parseInt(h.substring(0, 2), 16); | ||
* @memberof Color | ||
* @param {String} hex - 3(or 4)-digit hex color | ||
* @return {String} 6(or 8)-digit hex color | ||
* @param {} hex - 3(or 4)-digit hex color | ||
* @return {} 6(or 8)-digit hex color | ||
* @example | ||
@@ -63,3 +63,3 @@ import {toFullHex} from "@daybrush/utils"; | ||
*/ | ||
export function toFullHex(h: string) { | ||
export function toFullHex(h: string): string { | ||
const r = h.charAt(1); | ||
@@ -76,4 +76,4 @@ const g = h.charAt(2); | ||
* @memberof Color | ||
* @param {Array} hsl(a) - hsl color(hue: 0 ~ 360, saturation: 0 ~ 1, lightness: 0 ~ 1, alpha: 0 ~ 1) | ||
* @return {Array} rgba color | ||
* @param {} hsl - hsl color(hue: 0 ~ 360, saturation: 0 ~ 1, lightness: 0 ~ 1, alpha: 0 ~ 1) | ||
* @return {} rgba color | ||
* @example | ||
@@ -85,3 +85,3 @@ import {hslToRGBA} from "@daybrush/utils"; | ||
*/ | ||
export function hslToRGBA(hsl: number[]) { | ||
export function hslToRGBA(hsl: number[]): number[] { | ||
let h = hsl[0]; | ||
@@ -126,4 +126,4 @@ const s = hsl[1]; | ||
* @memberof Color | ||
* @param {String} - 3-hex(#000), 4-hex(#0000) 6-hex(#000000), 8-hex(#00000000) or RGB(A), or HSL(A) | ||
* @return {Array} rgba color | ||
* @param {} - 3-hex(#000), 4-hex(#0000) 6-hex(#000000), 8-hex(#00000000) or RGB(A), or HSL(A) | ||
* @return {} rgba color | ||
* @example | ||
@@ -136,3 +136,3 @@ import {stringToRGBA} from "@daybrush/utils"; | ||
*/ | ||
export function stringToRGBA(color: string) { | ||
export function stringToRGBA(color: string): number[] { | ||
if (color.charAt(0) === "#") { | ||
@@ -139,0 +139,0 @@ if (color.length === 4 || color.length === 5) { |
@@ -6,3 +6,6 @@ /** | ||
export interface ObjectInterface<T> { | ||
/** | ||
* @typedef | ||
*/ | ||
export interface IObject<T> { | ||
[name: string]: T; | ||
@@ -9,0 +12,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { ObjectInterface } from "./consts"; | ||
import { IObject } from "./consts"; | ||
@@ -10,4 +10,4 @@ /** | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to search | ||
* @param element - target | ||
* @param className - the class name to search | ||
* @return {boolean} return false if the class is not found. | ||
@@ -29,4 +29,4 @@ * @example | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to add | ||
* @param element - target | ||
* @param className - the class name to add | ||
* @example | ||
@@ -48,4 +48,4 @@ import {addClass} from "@daybrush/utils"; | ||
* @memberof DOM | ||
* @param {HTMLElement} element - target | ||
* @param {string} className - the class name to remove | ||
* @param element - target | ||
* @param className - the class name to remove | ||
* @example | ||
@@ -69,5 +69,5 @@ import {removeClass} from "@daybrush/utils"; | ||
* @memberof DOM | ||
* @param {HTMLElement | HTMLElement[]} elements - elements | ||
* @param {string[]} properites - the CSS properties | ||
* @return {object} returns CSS properties and values. | ||
* @param elements - elements | ||
* @param properites - the CSS properties | ||
* @return returns CSS properties and values. | ||
* @example | ||
@@ -78,3 +78,4 @@ import {fromCSS} from "@daybrush/utils"; | ||
*/ | ||
export function fromCSS(elements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>, properties: string[]) { | ||
export function fromCSS( | ||
elements: HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>, properties: string[]): IObject<any> { | ||
if (!elements || !properties || !properties.length) { | ||
@@ -92,3 +93,3 @@ return {}; | ||
} | ||
const cssObject: ObjectInterface<any> = {}; | ||
const cssObject: IObject<any> = {}; | ||
const styles = window.getComputedStyle(element) as any; | ||
@@ -95,0 +96,0 @@ const length = properties.length; |
@@ -1,2 +0,2 @@ | ||
import { ObjectInterface, UNDEFINED, STRING, OBJECT, FUNCTION, IS_WINDOW } from "./consts"; | ||
import { IObject, UNDEFINED, STRING, OBJECT, FUNCTION, IS_WINDOW } from "./consts"; | ||
/** | ||
@@ -27,3 +27,3 @@ * @namespace | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -37,3 +37,3 @@ import {isObject} from "@daybrush/utils"; | ||
*/ | ||
export function isObject(value: any): value is ObjectInterface<any> { | ||
export function isObject(value: any): value is IObject<any> { | ||
return value && (typeof value === OBJECT); | ||
@@ -45,3 +45,3 @@ } | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -62,3 +62,3 @@ import {isArray} from "@daybrush/utils"; | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -79,3 +79,3 @@ import {isString} from "@daybrush/utils"; | ||
* @param {string} value - Value to check the type | ||
* @return {boolean} true if the type is correct, false otherwise | ||
* @return {} true if the type is correct, false otherwise | ||
* @example | ||
@@ -158,3 +158,3 @@ import {isFunction} from "@daybrush/utils"; | ||
* @param {string} text - text to divide | ||
* @return {object} divided texts | ||
* @return {} divided texts | ||
* @example | ||
@@ -170,3 +170,3 @@ import {splitUnit} from "@daybrush/utils"; | ||
*/ | ||
export function splitUnit(text: string) { | ||
export function splitUnit(text: string): {prefix: string, unit: string, value: number} { | ||
const matches = /^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(text); | ||
@@ -173,0 +173,0 @@ |
@@ -10,3 +10,2 @@ { | ||
"indent": [true, "spaces", 2], | ||
"interface-name": false, | ||
"ordered-imports": false, | ||
@@ -13,0 +12,0 @@ "object-literal-sort-keys": false, |
Sorry, the diff of this file is not supported yet
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
156853
27
2298