@quartz/js-utils
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -9,3 +11,3 @@ * Create an array of integers from min to max, inclusive. | ||
*/ | ||
export default function arrayFromRange(min, max, increment = 1) { | ||
function arrayFromRange(min, max, increment = 1) { | ||
const arr = new Array(Math.ceil((max - min) / increment)) | ||
@@ -19,2 +21,3 @@ .fill(null) | ||
} | ||
exports.default = arrayFromRange; | ||
//# sourceMappingURL=arrayFromRange.js.map |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -7,3 +9,3 @@ * Convert a hex color like #336699 to an array of RGB values. | ||
*/ | ||
export default function hexToRGB(hexColor) { | ||
function hexToRGB(hexColor) { | ||
// Remove # from arg. | ||
@@ -18,2 +20,3 @@ let hex = hexColor.slice(1); | ||
} | ||
exports.default = hexToRGB; | ||
//# sourceMappingURL=hexToRGB.js.map |
@@ -1,5 +0,12 @@ | ||
export { default as arrayFromRange } from './arrayFromRange'; | ||
export { default as hexToRGB } from './hexToRGB'; | ||
export { default as minifyCss } from './minifyCss'; | ||
export { default as resizeWPImage } from './resizeWPImage'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resizeWPImage = exports.minifyCss = exports.hexToRGB = exports.arrayFromRange = void 0; | ||
var arrayFromRange_1 = require("./arrayFromRange"); | ||
Object.defineProperty(exports, "arrayFromRange", { enumerable: true, get: function () { return arrayFromRange_1.default; } }); | ||
var hexToRGB_1 = require("./hexToRGB"); | ||
Object.defineProperty(exports, "hexToRGB", { enumerable: true, get: function () { return hexToRGB_1.default; } }); | ||
var minifyCss_1 = require("./minifyCss"); | ||
Object.defineProperty(exports, "minifyCss", { enumerable: true, get: function () { return minifyCss_1.default; } }); | ||
var resizeWPImage_1 = require("./resizeWPImage"); | ||
Object.defineProperty(exports, "resizeWPImage", { enumerable: true, get: function () { return resizeWPImage_1.default; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -8,5 +10,6 @@ * A quick and dirty way to minify CSS that is being directly injected into the | ||
*/ | ||
export default function minifyCss(css) { | ||
function minifyCss(css) { | ||
return css.replace(/\s*([{}\(\);:,])\s*/g, '$1'); | ||
} | ||
exports.default = minifyCss; | ||
//# sourceMappingURL=minifyCss.js.map |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -11,3 +13,3 @@ * Resize an image from our WordPress media library (powered by Photon). | ||
*/ | ||
export default function resizeWPImage(url, width, height, crop = false, quality = 75) { | ||
function resizeWPImage(url, width, height, crop = false, quality = 75) { | ||
const { origin, pathname } = new URL(url); | ||
@@ -26,2 +28,3 @@ let resizedUrl = `${origin}${pathname}?quality=${quality}&strip=all`; | ||
} | ||
exports.default = resizeWPImage; | ||
//# sourceMappingURL=resizeWPImage.js.map |
{ | ||
"name": "@quartz/js-utils", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A collection of reusable JavaScript utilities for Quartz products.", | ||
@@ -15,3 +15,3 @@ "main": "dist/index.js", | ||
"build": "tsc", | ||
"prepublishOnly": "npm run build" | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -18,0 +18,0 @@ "repository": { |
@@ -1,36 +0,3 @@ | ||
# Quartz JavaScript utilities | ||
# JavaScript utilities | ||
[![npm version](https://badge.fury.io/js/%40quartz%2Fjs-utils.svg)](https://badge.fury.io/js/%40quartz%2Fjs-utils) | ||
A collection of reusable JavaScript utilities for Quartz products, with optional TypeScript support. | ||
All functions are written in TypeScript and transpiled into ES2017 JavaScript (with type definitions). | ||
## Installation | ||
`npm i @quartz/js-utils` | ||
## Usage | ||
Import functions from the js-utils package, e.g. | ||
`import { arrayFromRange, resizeWPImage } from '@quartz/js-utils'` | ||
TypeScript hints are available if the file into which the functions are imported is a `.ts` or `.tsx` file. | ||
## Contributing | ||
Functions must be written in TypeScript whenever possible. | ||
Export one function per file with a test suite (`.test.js`). | ||
### Before opening a pull request | ||
- Export any new functions to `src/index.ts` | ||
- Add a test suite for any new functions | ||
- Ensure tests pass (`npm t`) | ||
- Increment the package.json version using `npm version` | ||
## Deploying | ||
Use `npm publish` to publish the package to npm. TypeScript will be built on publish (via `npm run build`). | ||
A collection of reusable JavaScript utilities for Quartz products. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
129
7955
4