{"_id":"enhance","_rev":"16-7772dfc20bc4338fa1b1bb325e0aef41","name":"enhance","description":"A flexible node.js module for serving high-res images to high pixel density devices.","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.1":{"name":"enhance","version":"0.0.1","description":"A flexible node.js module for serving high-res images to high pixel density devices.","homepage":"https://github.com/jico/enhance","author":{"name":"Jico Baligod","email":"jico@baligod.com","url":"http://baligod.com"},"repository":{"type":"git","url":"https://github.com/jico/enhance"},"licenses":[{"type":"MIT","url":"http://github.com/jico/enhance/raw/master/LICENSE"}],"devDependencies":{"coffee-script":"1.6.3","expect.js":"0.2.0","jsdom":"0.5.6","mocha":"1.8.2"},"main":"./index.js","scripts":{"build":"./node_modules/.bin/coffee -co . src","test":"./node_modules/.bin/mocha --reporter spec --timeout 4000 --ignore-leaks","watch":"./node_modules/.bin/coffee -wo . src"},"_id":"enhance@0.0.1","dist":{"shasum":"4de75ccc156945f2ae5b1c37ba7f0982e9151a4e","tarball":"https://registry.npmjs.org/enhance/-/enhance-0.0.1.tgz","integrity":"sha512-CmPAZ5yG342V7+wOf3zeEF/V6xcKwkLoZrFL9MP+I6cKClCC6KdoP8rn5dS4DYLmrMGIfZJI64gGmVJOQBTBLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1IHECPyp1t0bPlZ5d6gNC9mC5kdkpHMvdyg73oJ1hGwIgFfze5HdqVRHOaPq2hk79Pz07yeyIx89TsTykJjM1zVo="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jico","email":"jico@baligod.com"},"maintainers":[{"name":"jico","email":"jico@baligod.com"}]},"0.0.2":{"name":"enhance","version":"0.0.2","description":"A flexible node.js module for serving high-res images to high pixel density devices.","homepage":"https://github.com/jico/enhance","author":{"name":"Jico Baligod","email":"jico@baligod.com","url":"http://baligod.com"},"repository":{"type":"git","url":"https://github.com/jico/enhance"},"licenses":[{"type":"MIT","url":"http://github.com/jico/enhance/raw/master/LICENSE"}],"devDependencies":{"coffee-script":"1.6.3","expect.js":"0.2.0","jsdom":"0.5.6","mocha":"1.8.2"},"main":"./index.js","scripts":{"build":"./node_modules/.bin/coffee -co . src","test":"./node_modules/.bin/mocha --reporter spec --timeout 4000 --ignore-leaks","watch":"./node_modules/.bin/coffee -wo . src"},"_id":"enhance@0.0.2","dist":{"shasum":"25cfab43d9a005f49f8300c6f179636d6ed6100c","tarball":"https://registry.npmjs.org/enhance/-/enhance-0.0.2.tgz","integrity":"sha512-0PleTg5TAn72awk6oD0e8h6F8foUtJQRs9Jsp2vcVAxIEU9PmvUKghWYtnz8Lh7UtvWMrWC06r+Gz4aUCoiOQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7r4ldkJhC4w1rwFz25Lo2Cjn+GQ2PsMd8Hr8sVdWEfAIhAM0Bgcm6RVcsUdNeffWxKCDCM2CdC7L7aA+gbpMWbjQW"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jico","email":"jico@baligod.com"},"maintainers":[{"name":"jico","email":"jico@baligod.com"}]},"0.0.3":{"name":"enhance","version":"0.0.3","description":"A flexible node.js module for serving high-res images to high pixel density devices.","homepage":"https://github.com/jico/enhance","author":{"name":"Jico Baligod","email":"jico@baligod.com","url":"http://baligod.com"},"repository":{"type":"git","url":"https://github.com/jico/enhance"},"licenses":[{"type":"MIT","url":"http://github.com/jico/enhance/raw/master/LICENSE"}],"devDependencies":{"coffee-script":"1.6.3","expect.js":"0.2.0","jsdom":"0.5.6","mocha":"1.8.2","sinon":"1.7.3"},"main":"./index.js","scripts":{"build":"./node_modules/.bin/coffee -co . src","test":"./node_modules/.bin/mocha --reporter spec --timeout 4000 --ignore-leaks","watch":"./node_modules/.bin/coffee -wo . src"},"_id":"enhance@0.0.3","dist":{"shasum":"43f3a24ee1da843420f5fd0deeed4cf642e7a85d","tarball":"https://registry.npmjs.org/enhance/-/enhance-0.0.3.tgz","integrity":"sha512-WOYse8/eDsGMVob+JyZL7T32kMpsfW+zdQkeeXVR4dpqkMH2BoVzG1HflXOg90rzqqlVG6f+Zp1YRuGIQUhQDg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAhtNk/V11cqlgVJc8ZPXMuRgCqxLjkAXHKDh+BFxV58AiEA+yUlk5D3SXJiHLg4crUwZXZ+FHPpRbH70g0wyArf2Us="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jico","email":"jico@baligod.com"},"maintainers":[{"name":"jico","email":"jico@baligod.com"}]},"0.0.5":{"name":"enhance","version":"0.0.5","description":"A flexible node.js module for serving high-res images to high pixel density devices.","homepage":"https://github.com/jico/enhance","author":{"name":"Jico Baligod","email":"jico@baligod.com","url":"http://baligod.com"},"repository":{"type":"git","url":"https://github.com/jico/enhance"},"licenses":[{"type":"MIT","url":"http://github.com/jico/enhance/raw/master/LICENSE"}],"devDependencies":{"coffee-script":"1.6.3","expect.js":"0.2.0","jsdom":"0.5.6","mocha":"1.8.2","sinon":"1.7.3"},"main":"./index.js","scripts":{"build":"./node_modules/.bin/coffee -co . src","test":"./node_modules/.bin/mocha --reporter spec --timeout 4000 --ignore-leaks","watch":"./node_modules/.bin/coffee -wo . src"},"_id":"enhance@0.0.5","dist":{"shasum":"b98cb5fa2a407edb0fc241ccc76c1cfad0d817df","tarball":"https://registry.npmjs.org/enhance/-/enhance-0.0.5.tgz","integrity":"sha512-5VLCEto8OJqU/RRKIf8YryxYc3RAKhUzcZJmMV6DwBqccn9a8dfceNhbAv9kx6rnx6bKLF4Na4KA1ZJMYh670w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBLyWGGjYs4qMb9TwVzXIsZ3wMrKAdmVG7jk0qvsBIa9AiAsQ685n+VMlV8ztpT4mKBZ2sWKs/b53fDVNSLZbwjy0w=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jico","email":"jico@baligod.com"},"maintainers":[{"name":"jico","email":"jico@baligod.com"}]},"0.0.6":{"name":"enhance","version":"0.0.6","description":"A flexible node.js module for serving high-res images to high pixel density devices.","homepage":"https://github.com/jico/enhance","author":{"name":"Jico Baligod","email":"jico@baligod.com","url":"http://baligod.com"},"repository":{"type":"git","url":"https://github.com/jico/enhance"},"licenses":[{"type":"MIT","url":"http://github.com/jico/enhance/raw/master/LICENSE"}],"devDependencies":{"coffee-script":"1.6.3","expect.js":"0.2.0","jsdom":"0.5.6","mocha":"1.8.2","sinon":"1.7.3"},"main":"./index.js","scripts":{"build":"./node_modules/.bin/coffee -co . src","test":"./node_modules/.bin/mocha --reporter spec --timeout 4000 --ignore-leaks","watch":"./node_modules/.bin/coffee -wo . src"},"_id":"enhance@0.0.6","dist":{"shasum":"83c732c2751a8a3956fd6cade096e1e9b7e55649","tarball":"https://registry.npmjs.org/enhance/-/enhance-0.0.6.tgz","integrity":"sha512-wmfVlohtibUuIbXsDNMGxBXYd77jST4ZXuh9xxPS2SOACvD6V5yz2KUUQ+in6UYRfssosR1L75OiImL5FHOUMA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCL6fmgu50AcZCCndvBlniESG4Os1+f2G0X2xfBe40uaQIhAMmaHMUA53ETY3WHhOBbcxjooxzMtTfpixlqm4sIKsOD"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jico","email":"jico@baligod.com"},"maintainers":[{"name":"jico","email":"jico@baligod.com"}]},"0.0.7":{"name":"enhance","version":"0.0.7","description":"A flexible node.js module for serving high-res images to high pixel density devices.","homepage":"https://github.com/jico/enhance","author":{"name":"Jico Baligod","email":"jico@baligod.com","url":"http://baligod.com"},"repository":{"type":"git","url":"https://github.com/jico/enhance"},"licenses":[{"type":"MIT","url":"http://github.com/jico/enhance/raw/master/LICENSE"}],"devDependencies":{"browserify":"3.2.2","coffee-script":"1.6.3","expect.js":"0.2.0","jsdom":"0.5.6","mocha":"1.8.2","sinon":"1.7.3"},"main":"./index.js","scripts":{"build":"./node_modules/.bin/coffee -co . src && ./node_modules/.bin/browserify lib/enhance.js -o build/enhance.js","test":"./node_modules/.bin/mocha --reporter spec --timeout 4000 --ignore-leaks","watch":"./node_modules/.bin/coffee -wo . src && ./node_modules/.bin/browserify lib/enhance.js -o build/enhance.js"},"_id":"enhance@0.0.7","dist":{"shasum":"8501025d2812f3fb0502b90e6d4aee730159fc24","tarball":"https://registry.npmjs.org/enhance/-/enhance-0.0.7.tgz","integrity":"sha512-P0e4xsrOUXH73VJZDGraUhhAlIq0MsJYp/NpjNOeZcHfRmKrMCS+O2T+GFPwCdy3ITDWW4DCmPxmy0+0aFbXeQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD5TkGD//k4PQ+qTeLewW2JKVmA+wDjyV14e7q+Y+z8rgIhAPz3bw3o2gfk195rvUj+7itSLcmQUT9+VxhFjravhVi7"}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"jico","email":"jico@baligod.com"},"maintainers":[{"name":"jico","email":"jico@baligod.com"}]}},"readme":"# Enhance [![Build Status](https://secure.travis-ci.org/jico/enhance.png?branch=master)](http://travis-ci.org/jico/enhance)\n\nA flexible node.js module for serving high-res images to high pixel density devices.\n\n## Installation\n\nAdd `enhance` to your `package.json` file and run `npm install`.\n\nAlternatively, you can run `npm install enhance --save`.\n\nIf you're using Hem, make sure to add it to your `slug.json` file as a\ndependency.\n\n## Usage\n\nRequire _Enhance_ in your app, optionally passing in initialization options, and\ntypically set to a global variable. In CoffeeScript, it would look something\nlike:\n\n```coffee\nEnhance = require('enhance')(options)\n```\n\nYou can also use the browserified version by including `build/enhance.js` in\nyour app and passing in your options to the `Enhance` object on the `window`.\n\n```coffee\nEnhance(options).render('image.png')\n```\n\n### `render`\n\nGiven no [configuration options](#configuration), _Enhance_ falls back to\nApple's convention of suffixing image file names with `@2x` before the\nextension if a Retina or other high DPI display is detected.\n\nFor example, consider calling the main function `render` on a Retina device:\n\n```coffee\nEnhance.render('image.png')\n# => \"image@2x.png\"\n```\n\nIf the device does not have a high DPI, the call to `render` will simply return\nthe file name unaltered (unless initialization options have been passed).\n\n### `isHiDPI`\n\nYou can use the available method `isHiDPI` to check if a device is one of high\nDPI. The default device pixel ratio is 1.3, but `isHiDPI` takes an optional\nratio parameter to use as a threshold.\n\n### `isMobileDevice`\n\nTo detect whether a user is on a mobile device, you can call `isMobileDevice`,\nwhich uses `max-width` media queries as a test.\n\nBy default, tablets are not considered mobile devices. However, you can consider\nthem by enabling the `tabletAsMobile` option when initializing _Enhance_:\n\nAdditionally, you can override the width breakpoints for both mobile and tablet\ndevices, see [configuration](#configuration). The default breakpoints are:\n\n```coffee\nphoneBreakpoint:  480\ntabletBreakpoint: 1024\n```\n\n## Configuration\n\n_Enhance_ accepts initial configuration options to provide flexibility if your\napp doesn't follow Apple's Retina naming convention.\n\n### host\n\nPrepends the given `host` value to file names passed to the call to `render`.\n\n__Default:__ _null_\n\n```coffee\nEnhance = require('enhance')(host: 'http://www.example.com')\nEnhance.render('image.png')\n# => \"http://www.example.com/image@2x.png\" (high DPI)\n```\n\n### suffix\n\nThe string to prepend before the file name extension.\n\n__Default:__ _\"@2x\"_\n\n```coffee\nEnhance = require('enhance')(suffix: '_2x')\nEnhance.render('image.png')\n# => \"image_2x.png\" (high DPI)\n```\n\n### render\n\nCustom callback function to use in place of the default `render` method. Passes\nin a helper object that makes available the following:\n\n* `isHiDPI`\n* `_` - [lodash](http://lodash.com) function with additional extensions:\n  * `joinURIComponents` - Joins any number of URI string component arguments\n  while preserving double slashes (i.e. the case of `http://`)\n* `src` - String argument of `render`\n* Any and all other parameters passed upon initialization or the call to `render`\n\n```coffee\noptions =\n  host: 'http://example.com/transform'\n  suffix: '_2x'\n  render: (helpers) ->\n    if helpers.isHiDPI()\n      path = \"#{encodeURIComponent(helpers.src)}/resize/#{helpers.width*2}x#{helpers.height*2}#\"\n    else\n      path = \"#{encodeURIComponent(helpers.src)}/resize/#{helpers.width}x#{helpers.height}#\"\n    helpers._.joinURIComponents(helpers.host, path)\n\nEnhance = require('enhance')(options)\n\nEnhance.render('image.png', width: 50, height: 100)\n```\n\n### phoneBreakpoint\n\nBreakpoint for detecting mobile phone devices. Used by `isMobileDevice` method.\n\n__Default__: _480_\n\n### tabletBreakpoint\n\nBreakpoint for detecting mobile tablet devices. Used by `isMobileDevice` method.\n\n__Default__: _1024_\n\n### tabletAsMobile\n\n__Default__: _false_\n\nEnables consideration on tablets as mobile devices.\n\n\n## License\n\nCopyright 2013 Jico Baligod.\n\nLicensed under the [MIT License](http://github.com/jico/enhance/raw/master/LICENSE).\n","maintainers":[{"name":"jico","email":"jico@baligod.com"}],"time":{"modified":"2022-06-17T05:35:08.692Z","created":"2013-07-29T19:07:07.769Z","0.0.1":"2013-07-29T19:07:08.871Z","0.0.2":"2013-08-11T21:25:44.171Z","0.0.3":"2013-08-12T20:10:47.081Z","0.0.5":"2013-10-02T21:55:44.324Z","0.0.6":"2013-10-07T21:54:01.656Z","0.0.7":"2013-12-13T20:20:41.819Z"},"author":{"name":"Jico Baligod","email":"jico@baligod.com","url":"http://baligod.com"},"repository":{"type":"git","url":"https://github.com/jico/enhance"},"readmeFilename":"README.md"}