Comparing version 1.3.1 to 1.3.2
1083
dist/toStyle.js
@@ -1,12 +0,891 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.toStyle=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.toStyle=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = { | ||
prefixProperties: _dereq_('./src/prefixProperties') , | ||
object: _dereq_('./src/toStyleObject'), | ||
string: _dereq_('./src/toStyleString') | ||
prefixProperties: require('./src/prefixProperties') , | ||
cssUnitless: require('./src/cssUnitless') , | ||
object: require('./src/toStyleObject'), | ||
string: require('./src/toStyleString') | ||
} | ||
},{"./src/prefixProperties":17,"./src/toStyleObject":19,"./src/toStyleString":20}],2:[function(_dereq_,module,exports){ | ||
},{"./src/cssUnitless":34,"./src/prefixProperties":39,"./src/toStyleObject":41,"./src/toStyleString":42}],2:[function(require,module,exports){ | ||
module.exports = { | ||
toLowerFirst : require('./src/toLowerFirst'), | ||
toUpperFirst : require('./src/toUpperFirst'), | ||
separate : require('./src/separate'), | ||
stripWhitespace : require('./src/stripWhitespace'), | ||
compactWhitespace: require('./src/compactWhitespace'), | ||
camelize : require('./src/camelize'), | ||
humanize : require('./src/humanize'), | ||
hyphenate : require('./src/hyphenate'), | ||
endsWith : require('./src/endsWith'), | ||
is: require('./src/is') | ||
} | ||
},{"./src/camelize":18,"./src/compactWhitespace":19,"./src/endsWith":20,"./src/humanize":21,"./src/hyphenate":23,"./src/is":26,"./src/separate":29,"./src/stripWhitespace":30,"./src/toLowerFirst":31,"./src/toUpperFirst":32}],3:[function(require,module,exports){ | ||
/** | ||
* Utility methods for working with functions. | ||
* These methods augment the Function prototype. | ||
* | ||
* Using {@link #before} | ||
* | ||
* function log(m){ | ||
* console.log(m) | ||
* } | ||
* | ||
* var doLog = function (m){ | ||
* console.log('LOG ') | ||
* }.before(log) | ||
* | ||
* doLog('test') | ||
* //will log | ||
* //"LOG " | ||
* //and then | ||
* //"test" | ||
* | ||
* | ||
* | ||
* Using {@link #bindArgs}: | ||
* | ||
* //returns the sum of all arguments | ||
* function add(){ | ||
* var sum = 0 | ||
* [].from(arguments).forEach(function(n){ | ||
* sum += n | ||
* }) | ||
* | ||
* return sum | ||
* } | ||
* | ||
* var add1 = add.bindArgs(1) | ||
* | ||
* add1(2, 3) == 6 | ||
* | ||
* Using {@link #lockArgs}: | ||
* | ||
* function add(){ | ||
* var sum = 0 | ||
* [].from(arguments).forEach(function(n){ | ||
* sum += n | ||
* }) | ||
* | ||
* return sum | ||
* } | ||
* | ||
* var add1_2 = add.lockArgs(1,2) | ||
* var add1_2_3 = add.lockArgs(1,2,3) | ||
* | ||
* add1_2(3,4) == 3 //args are locked to only be 1 and 2 | ||
* add1_2_3(6) == 6 //args are locked to only be 1, 2 and 3 | ||
* | ||
* | ||
* | ||
* Using {@link #compose}: | ||
* | ||
* function multiply(a,b){ | ||
* return a* b | ||
* } | ||
* | ||
* var multiply2 = multiply.curry()(2) | ||
* | ||
* Function.compose(multiply2( add(5,6) )) == multiply2( add(5,6) ) | ||
* | ||
* | ||
* @class Function | ||
*/ | ||
var SLICE = Array.prototype.slice | ||
var composeTwo = function(f, g) { | ||
return function () { | ||
return f(g.apply(this, arguments)) | ||
} | ||
}, | ||
curry = function(fn, n){ | ||
if (typeof n !== 'number'){ | ||
n = fn.length | ||
} | ||
function getCurryClosure(prevArgs){ | ||
function curryClosure() { | ||
var len = arguments.length, | ||
args = [].concat(prevArgs) | ||
if (len){ | ||
args.push.apply(args, arguments) | ||
} | ||
if (args.length < n){ | ||
return getCurryClosure(args) | ||
} | ||
return fn.apply(this, args) | ||
} | ||
return curryClosure | ||
} | ||
return getCurryClosure([]) | ||
}, | ||
find = curry(function(fn, target){ | ||
if (typeof target.find == 'function'){ | ||
return target.find(fn) | ||
} | ||
if (Array.isArray(target)){ | ||
var i = 0 | ||
var len = target.length | ||
var it | ||
for(; i < len; i++){ | ||
it = target[i] | ||
if (fn(it, i, target)){ | ||
return it | ||
} | ||
} | ||
return | ||
} | ||
if (typeof target == 'object'){ | ||
var keys = Object.keys(target) | ||
var i = 0 | ||
var len = keys.length | ||
var k | ||
var it | ||
for( ; i < len; i++){ | ||
k = keys[i] | ||
it = target[k] | ||
if (fn(it, k, target)){ | ||
return it | ||
} | ||
} | ||
} | ||
}), | ||
bindFunctionsOf = function(obj) { | ||
Object.keys(obj).forEach(function(k){ | ||
if (typeof obj[k] == 'function'){ | ||
obj[k] = obj[k].bind(obj) | ||
} | ||
}) | ||
return obj | ||
}, | ||
/* | ||
* @param {Function...} an enumeration of functions, each consuming the result of the following function. | ||
* | ||
* For example: compose(c, b, a)(1,4) == c(b(a(1,4))) | ||
* | ||
* @return the result of the first function in the enumeration | ||
*/ | ||
compose = function(){ | ||
var args = arguments | ||
var len = args.length | ||
var i = 0 | ||
var f = args[0] | ||
while (++i < len) { | ||
f = composeTwo(f, args[i]) | ||
} | ||
return f | ||
}, | ||
chain = function(where, fn, secondFn){ | ||
var fns = [ | ||
where === 'before'? secondFn: fn, | ||
where !== 'before'? secondFn: fn | ||
] | ||
return function(){ | ||
if (where === 'before'){ | ||
secondFn.apply(this, arguments) | ||
} | ||
var result = fn.apply(this, arguments) | ||
if (where !== 'before'){ | ||
secondFn.apply(this, arguments) | ||
} | ||
return result | ||
} | ||
}, | ||
forward = function(fn, scope){ | ||
return fn.bind? | ||
fn.bind(scope): | ||
function(){ | ||
return fn.apply(scope, arguments) | ||
} | ||
}, | ||
once = function(fn, scope){ | ||
var called = false, | ||
result | ||
return function(){ | ||
if (called){ | ||
return result | ||
} | ||
called = true | ||
return result = fn.call(scope || this) | ||
} | ||
}, | ||
bindArgsArray = function(fn, args){ | ||
return function(){ | ||
var thisArgs = SLICE.call(args || []) | ||
if (arguments.length){ | ||
thisArgs.push.apply(thisArgs, arguments) | ||
} | ||
return fn.apply(this, thisArgs) | ||
} | ||
}, | ||
bindArgs = function(fn){ | ||
return bindArgsArray(fn, SLICE.call(arguments,1)) | ||
}, | ||
lock = function(fn, scope){ | ||
var args = SLICE.call(arguments, 2) | ||
return function(){ | ||
return fn.apply(scope, args) | ||
} | ||
}, | ||
lockArgsArray = function(fn, args){ | ||
return function(){ | ||
if (!Array.isArray(args)){ | ||
args = SLICE.call(args || []) | ||
} | ||
return fn.apply(this, args) | ||
} | ||
}, | ||
lockArgs = function(fn){ | ||
return lockArgsArray(fn, SLICE.call(arguments, 1) ) | ||
}, | ||
skipArgs = function(fn, count){ | ||
return function(){ | ||
var args = SLICE.call(arguments, count || 0) | ||
return fn.apply(this, args) | ||
} | ||
}, | ||
intercept = function(interceptedFn, interceptingFn, withStopArg){ | ||
return function(){ | ||
var args = [].from(arguments), | ||
stopArg = { stop: false } | ||
if (withStopArg){ | ||
args.push(stopArg) | ||
} | ||
var result = interceptingFn.apply(this, args) | ||
if (withStopArg){ | ||
if (stopArg.stop === true){ | ||
return result | ||
} | ||
} else { | ||
if (result === false){ | ||
return result | ||
} | ||
} | ||
//the interception was not stopped | ||
return interceptedFn.apply(this, arguments) | ||
} | ||
}, | ||
delay = function(fn, delay, scope){ | ||
var delayIsNumber = delay * 1 == delay | ||
if (arguments.length == 2 && !delayIsNumber){ | ||
scope = delay | ||
delay = 0 | ||
} else { | ||
if (!delayIsNumber){ | ||
delay = 0 | ||
} | ||
} | ||
return function(){ | ||
var self = scope || this, | ||
args = arguments | ||
if (delay < 0){ | ||
fn.apply(self, args) | ||
return | ||
} | ||
if (delay || !setImmediate){ | ||
setTimeout(function(){ | ||
fn.apply(self, args) | ||
}, delay) | ||
} else { | ||
setImmediate(function(){ | ||
fn.apply(self, args) | ||
}) | ||
} | ||
} | ||
}, | ||
defer = function(fn, scope){ | ||
return delay(fn, 0, scope) | ||
}, | ||
buffer = function(fn, delay, scope){ | ||
var timeoutId = -1 | ||
return function(){ | ||
var self = scope || this, | ||
args = arguments | ||
if (delay < 0){ | ||
fn.apply(self, args) | ||
return | ||
} | ||
var withTimeout = delay || !setImmediate, | ||
clearFn = withTimeout? | ||
clearTimeout: | ||
clearImmediate, | ||
setFn = withTimeout? | ||
setTimeout: | ||
setImmediate | ||
if (timeoutId !== -1){ | ||
clearFn(timeoutId) | ||
} | ||
timeoutId = setFn(function(){ | ||
fn.apply(self, args) | ||
self = null | ||
}, delay) | ||
} | ||
}, | ||
throttle = function(fn, delay, scope) { | ||
var timeoutId = -1, | ||
self, | ||
args | ||
return function () { | ||
self = scope || this | ||
args = arguments | ||
if (timeoutId !== -1) { | ||
//the function was called once again in the delay interval | ||
} else { | ||
timeoutId = setTimeout(function () { | ||
fn.apply(self, args) | ||
self = null | ||
timeoutId = -1 | ||
}, delay) | ||
} | ||
} | ||
}, | ||
maxArgs = function(fn, count){ | ||
return function(){ | ||
return fn.apply(this, SLICE.call(arguments, 0, count)) | ||
} | ||
}, | ||
spread = function(fn, delay, scope){ | ||
var timeoutId = -1 | ||
var callCount = 0 | ||
var executeCount = 0 | ||
var nextArgs = {} | ||
var increaseCounter = true | ||
var resultingFnUnbound | ||
var resultingFn | ||
resultingFn = resultingFnUnbound = function(){ | ||
var args = arguments, | ||
self = scope || this | ||
if (increaseCounter){ | ||
nextArgs[callCount++] = {args: args, scope: self} | ||
} | ||
if (timeoutId !== -1){ | ||
//the function was called once again in the delay interval | ||
} else { | ||
timeoutId = setTimeout(function(){ | ||
fn.apply(self, args) | ||
timeoutId = -1 | ||
executeCount++ | ||
if (callCount !== executeCount){ | ||
resultingFn = bindArgsArray(resultingFnUnbound, nextArgs[executeCount].args).bind(nextArgs[executeCount].scope) | ||
delete nextArgs[executeCount] | ||
increaseCounter = false | ||
resultingFn.apply(self) | ||
increaseCounter = true | ||
} else { | ||
nextArgs = {} | ||
} | ||
}, delay) | ||
} | ||
} | ||
return resultingFn | ||
}, | ||
/* | ||
* @param {Array} args the array for which to create a cache key | ||
* @param {Number} [cacheParamNumber] the number of args to use for the cache key. Use this to limit the args that area actually used for the cache key | ||
*/ | ||
getCacheKey = function(args, cacheParamNumber){ | ||
if (cacheParamNumber == null){ | ||
cacheParamNumber = -1 | ||
} | ||
var i = 0, | ||
len = Math.min(args.length, cacheParamNumber), | ||
cacheKey = [], | ||
it | ||
for ( ; i < len; i++){ | ||
it = args[i] | ||
if (root.check.isPlainObject(it) || Array.isArray(it)){ | ||
cacheKey.push(JSON.stringify(it)) | ||
} else { | ||
cacheKey.push(String(it)) | ||
} | ||
} | ||
return cacheKey.join(', ') | ||
}, | ||
/* | ||
* @param {Function} fn - the function to cache results for | ||
* @param {Number} skipCacheParamNumber - the index of the boolean parameter that makes this function skip the caching and | ||
* actually return computed results. | ||
* @param {Function|String} cacheBucketMethod - a function or the name of a method on this object which makes caching distributed across multiple buckets. | ||
* If given, cached results will be searched into the cache corresponding to this bucket. If no result found, return computed result. | ||
* | ||
* For example this param is very useful when a function from a prototype is cached, | ||
* but we want to return the same cached results only for one object that inherits that proto, not for all objects. Thus, for example for Wes.Element, | ||
* we use the 'getId' cacheBucketMethod to indicate cached results for one object only. | ||
* @param {Function} [cacheKeyBuilder] A function to be used to compose the cache key | ||
* | ||
* @return {Function} a new function, which returns results from cache, if they are available, otherwise uses the given fn to compute the results. | ||
* This returned function has a 'clearCache' function attached, which clears the caching. If a parameter ( a bucket id) is provided, | ||
* only clears the cache in the specified cache bucket. | ||
*/ | ||
cache = function(fn, config){ | ||
config = config || {} | ||
var bucketCache = {}, | ||
cache = {}, | ||
skipCacheParamNumber = config.skipCacheIndex, | ||
cacheBucketMethod = config.cacheBucket, | ||
cacheKeyBuilder = config.cacheKey, | ||
cacheArgsLength = skipCacheParamNumber == null? | ||
fn.length: | ||
skipCacheParamNumber, | ||
cachingFn | ||
cachingFn = function(){ | ||
var result, | ||
skipCache = skipCacheParamNumber != null? | ||
arguments[skipCacheParamNumber] === true: | ||
false, | ||
args = skipCache? | ||
SLICE.call(arguments, 0, cacheArgsLength): | ||
SLICE.call(arguments), | ||
cacheBucketId = cacheBucketMethod != null? | ||
typeof cacheBucketMethod == 'function'? | ||
cacheBucketMethod(): | ||
typeof this[cacheBucketMethod] == 'function'? | ||
this[cacheBucketMethod](): | ||
null | ||
: | ||
null, | ||
cacheObject = cacheBucketId? | ||
bucketCache[cacheBucketId]: | ||
cache, | ||
cacheKey = (cacheKeyBuilder || getCacheKey)(args, cacheArgsLength) | ||
if (cacheBucketId && !cacheObject){ | ||
cacheObject = bucketCache[cacheBucketId] = {} | ||
} | ||
if (skipCache || cacheObject[cacheKey] == null){ | ||
cacheObject[cacheKey] = result = fn.apply(this, args) | ||
} else { | ||
result = cacheObject[cacheKey] | ||
} | ||
return result | ||
} | ||
/* | ||
* @param {String|Object|Number} [bucketId] the bucket for which to clear the cache. If none given, clears all the cache for this function. | ||
*/ | ||
cachingFn.clearCache = function(bucketId){ | ||
if (bucketId){ | ||
delete bucketCache[String(bucketId)] | ||
} else { | ||
cache = {} | ||
bucketCache = {} | ||
} | ||
} | ||
/* | ||
* | ||
* @param {Array} cacheArgs The array of objects from which to create the cache key | ||
* @param {Number} [cacheParamNumber] A limit for the cache args that are actually used to compute the cache key. | ||
* @param {Function} [cacheKeyBuilder] The function to be used to compute the cache key from the given cacheArgs and cacheParamNumber | ||
*/ | ||
cachingFn.getCache = function(cacheArgs, cacheParamNumber, cacheKeyBuilder){ | ||
return cachingFn.getBucketCache(null, cacheArgs, cacheParamNumber, cacheKeyBuilder) | ||
} | ||
/* | ||
* | ||
* @param {String} bucketId The id of the cache bucket from which to retrieve the cached value | ||
* @param {Array} cacheArgs The array of objects from which to create the cache key | ||
* @param {Number} [cacheParamNumber] A limit for the cache args that are actually used to compute the cache key. | ||
* @param {Function} [cacheKeyBuilder] The function to be used to compute the cache key from the given cacheArgs and cacheParamNumber | ||
*/ | ||
cachingFn.getBucketCache = function(bucketId, cacheArgs, cacheParamNumber, cacheKeyBuilder){ | ||
var cacheObject = cache, | ||
cacheKey = (cacheKeyBuilder || getCacheKey)(cacheArgs, cacheParamNumber) | ||
if (bucketId){ | ||
bucketId = String(bucketId); | ||
cacheObject = bucketCache[bucketId] = bucketCache[bucketId] || {} | ||
} | ||
return cacheObject[cacheKey] | ||
} | ||
/* | ||
* | ||
* @param {Object} value The value to set in the cache | ||
* @param {Array} cacheArgs The array of objects from which to create the cache key | ||
* @param {Number} [cacheParamNumber] A limit for the cache args that are actually used to compute the cache key. | ||
* @param {Function} [cacheKeyBuilder] The function to be used to compute the cache key from the given cacheArgs and cacheParamNumber | ||
*/ | ||
cachingFn.setCache = function(value, cacheArgs, cacheParamNumber, cacheKeyBuilder){ | ||
return cachingFn.setBucketCache(null, value, cacheArgs, cacheParamNumber, cacheKeyBuilder) | ||
} | ||
/* | ||
* | ||
* @param {String} bucketId The id of the cache bucket for which to set the cache value | ||
* @param {Object} value The value to set in the cache | ||
* @param {Array} cacheArgs The array of objects from which to create the cache key | ||
* @param {Number} [cacheParamNumber] A limit for the cache args that are actually used to compute the cache key. | ||
* @param {Function} [cacheKeyBuilder] The function to be used to compute the cache key from the given cacheArgs and cacheParamNumber | ||
*/ | ||
cachingFn.setBucketCache = function(bucketId, value, cacheArgs, cacheParamNumber, cacheKeyBuilder){ | ||
var cacheObject = cache, | ||
cacheKey = (cacheKeyBuilder || getCacheKey)(cacheArgs, cacheParamNumber) | ||
if (bucketId){ | ||
bucketId = String(bucketId) | ||
cacheObject = bucketCache[bucketId] = bucketCache[bucketId] || {}; | ||
} | ||
return cacheObject[cacheKey] = value | ||
} | ||
return cachingFn | ||
} | ||
module.exports = { | ||
map: curry(function(fn, value){ | ||
return value != undefined && typeof value.map? | ||
value.map(fn): | ||
fn(value) | ||
}), | ||
dot: curry(function(prop, value){ | ||
return value != undefined? value[prop]: undefined | ||
}), | ||
maxArgs: curry(maxArgs), | ||
/** | ||
* @method compose | ||
* | ||
* Example: | ||
* | ||
* zippy.Function.compose(c, b, a) | ||
* | ||
* See {@link Function#compose} | ||
*/ | ||
compose: compose, | ||
/** | ||
* See {@link Function#self} | ||
*/ | ||
self: function(fn){ | ||
return fn | ||
}, | ||
/** | ||
* See {@link Function#buffer} | ||
*/ | ||
buffer: buffer, | ||
/** | ||
* See {@link Function#delay} | ||
*/ | ||
delay: delay, | ||
/** | ||
* See {@link Function#defer} | ||
* @param {Function} fn | ||
* @param {Object} scope | ||
*/ | ||
defer:defer, | ||
/** | ||
* See {@link Function#skipArgs} | ||
* @param {Function} fn | ||
* @param {Number} [count=0] how many args to skip when calling the resulting function | ||
* @return {Function} The function that will call the original fn without the first count args. | ||
*/ | ||
skipArgs: skipArgs, | ||
/** | ||
* See {@link Function#intercept} | ||
*/ | ||
intercept: function(fn, interceptedFn, withStopArgs){ | ||
return intercept(interceptedFn, fn, withStopArgs) | ||
}, | ||
/** | ||
* See {@link Function#throttle} | ||
*/ | ||
throttle: throttle, | ||
/** | ||
* See {@link Function#spread} | ||
*/ | ||
spread: spread, | ||
/** | ||
* See {@link Function#chain} | ||
*/ | ||
chain: function(fn, where, mainFn){ | ||
return chain(where, mainFn, fn) | ||
}, | ||
/** | ||
* See {@link Function#before} | ||
*/ | ||
before: function(fn, otherFn){ | ||
return chain('before', otherFn, fn) | ||
}, | ||
/** | ||
* See {@link Function#after} | ||
*/ | ||
after: function(fn, otherFn){ | ||
return chain('after', otherFn, fn) | ||
}, | ||
/** | ||
* See {@link Function#curry} | ||
*/ | ||
curry: curry, | ||
/** | ||
* See {@link Function#forward} | ||
*/ | ||
forward: forward, | ||
/** | ||
* See {@link Function#once} | ||
*/ | ||
once: once, | ||
/** | ||
* See {@link Function#bindArgs} | ||
*/ | ||
bindArgs: function(fn){ | ||
return bindArgsArray(fn, SLICE.call(arguments, 1)) | ||
}, | ||
/** | ||
* See {@link Function#bindArgsArray} | ||
*/ | ||
bindArgsArray: bindArgsArray, | ||
/** | ||
* See {@link Function#lockArgs} | ||
*/ | ||
lockArgs: function(fn){ | ||
return lockArgsArray(fn, SLICE.call(arguments, 1)) | ||
}, | ||
/** | ||
* See {@link Function#lockArgsArray} | ||
*/ | ||
lockArgsArray: lockArgsArray, | ||
bindFunctionsOf: bindFunctionsOf, | ||
find: find | ||
} | ||
},{}],4:[function(require,module,exports){ | ||
module.exports = require('./src') | ||
},{"./src":11}],5:[function(require,module,exports){ | ||
'use strict' | ||
var objectToString = Object.prototype.toString | ||
module.exports = function(value){ | ||
return objectToString.apply(value) === '[object Arguments]' || !!value.callee | ||
} | ||
},{}],6:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = function(value){ | ||
return Array.isArray(value) | ||
} | ||
},{}],7:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = function(value){ | ||
return typeof value == 'boolean' | ||
} | ||
},{}],8:[function(require,module,exports){ | ||
'use strict' | ||
var objectToString = Object.prototype.toString | ||
module.exports = function(value){ | ||
return objectToString.apply(value) === '[object Date]' | ||
} | ||
},{}],9:[function(require,module,exports){ | ||
'use strict' | ||
var number = require('./number') | ||
module.exports = function(value){ | ||
return number(value) && (value === parseFloat(value, 10)) && !(value === parseInt(value, 10)) | ||
} | ||
},{"./number":13}],10:[function(require,module,exports){ | ||
'use strict' | ||
var objectToString = Object.prototype.toString | ||
module.exports = function(value){ | ||
return objectToString.apply(value) === '[object Function]' | ||
} | ||
},{}],11:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = { | ||
'numeric' : require('./numeric'), | ||
'number' : require('./number'), | ||
'int' : require('./int'), | ||
'float' : require('./float'), | ||
'string' : require('./string'), | ||
'function' : require('./function'), | ||
'object' : require('./object'), | ||
'arguments': require('./arguments'), | ||
'boolean' : require('./boolean'), | ||
'date' : require('./date'), | ||
'regexp' : require('./regexp'), | ||
'array' : require('./array') | ||
} | ||
},{"./arguments":5,"./array":6,"./boolean":7,"./date":8,"./float":9,"./function":10,"./int":12,"./number":13,"./numeric":14,"./object":15,"./regexp":16,"./string":17}],12:[function(require,module,exports){ | ||
'use strict' | ||
var number = require('./number') | ||
module.exports = function(value){ | ||
return number(value) && (value === parseInt(value, 10)) | ||
} | ||
},{"./number":13}],13:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = function(value){ | ||
return typeof value === 'number' && isFinite(value) | ||
} | ||
},{}],14:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = function(value){ | ||
return !isNaN( parseFloat( value ) ) && isFinite( value ) | ||
} | ||
},{}],15:[function(require,module,exports){ | ||
'use strict' | ||
var objectToString = Object.prototype.toString | ||
module.exports = function(value){ | ||
return objectToString.apply(value) === '[object Object]' | ||
} | ||
},{}],16:[function(require,module,exports){ | ||
'use strict' | ||
var objectToString = Object.prototype.toString | ||
module.exports = function(value){ | ||
return objectToString.apply(value) === '[object RegExp]' | ||
} | ||
},{}],17:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = function(value){ | ||
return typeof value == 'string' | ||
} | ||
},{}],18:[function(require,module,exports){ | ||
'use strict' | ||
var toCamelFn = function(str, letter){ | ||
@@ -16,3 +895,3 @@ return letter ? letter.toUpperCase(): '' | ||
var hyphenRe = _dereq_('./hyphenRe') | ||
var hyphenRe = require('./hyphenRe') | ||
@@ -24,3 +903,3 @@ module.exports = function(str){ | ||
} | ||
},{"./hyphenRe":5}],3:[function(_dereq_,module,exports){ | ||
},{"./hyphenRe":22}],19:[function(require,module,exports){ | ||
var RE = /\s+/g | ||
@@ -35,10 +914,31 @@ | ||
} | ||
},{}],4:[function(_dereq_,module,exports){ | ||
},{}],20:[function(require,module,exports){ | ||
'use strict' | ||
var separate = _dereq_('./separate') | ||
var camelize = _dereq_('./camelize') | ||
var toUpperFirst = _dereq_('./toUpperFirst') | ||
var hyphenRe = _dereq_('./hyphenRe') | ||
module.exports = function(str, endsWith){ | ||
str += '' | ||
if (!str){ | ||
return typeof endsWith == 'string'? | ||
!endsWith: | ||
false | ||
} | ||
endsWith += '' | ||
if (str.length < endsWith.length){ | ||
return false | ||
} | ||
return str.lastIndexOf(endsWith) == str.length - endsWith.length | ||
} | ||
},{}],21:[function(require,module,exports){ | ||
'use strict' | ||
var separate = require('./separate') | ||
var camelize = require('./camelize') | ||
var toUpperFirst = require('./toUpperFirst') | ||
var hyphenRe = require('./hyphenRe') | ||
function toLowerAndSpace(str, letter){ | ||
@@ -57,8 +957,8 @@ return letter? ' ' + letter.toLowerCase(): ' ' | ||
},{"./camelize":2,"./hyphenRe":5,"./separate":8,"./toUpperFirst":11}],5:[function(_dereq_,module,exports){ | ||
},{"./camelize":18,"./hyphenRe":22,"./separate":29,"./toUpperFirst":32}],22:[function(require,module,exports){ | ||
module.exports = /[-\s]+(.)?/g | ||
},{}],6:[function(_dereq_,module,exports){ | ||
},{}],23:[function(require,module,exports){ | ||
'use strict' | ||
var separate = _dereq_('./separate') | ||
var separate = require('./separate') | ||
@@ -68,16 +968,40 @@ module.exports = function(name){ | ||
} | ||
},{"./separate":8}],7:[function(_dereq_,module,exports){ | ||
},{"./separate":29}],24:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = require('./match')(/^[a-zA-Z0-9]+$/) | ||
},{"./match":27}],25:[function(require,module,exports){ | ||
'use strict' | ||
var regex = /^[A-F0-9]{8}(?:-?[A-F0-9]{4}){3}-?[A-F0-9]{12}$/i | ||
var regex2 = /^\{[A-F0-9]{8}(?:-?[A-F0-9]{4}){3}-?[A-F0-9]{12}\}$/i | ||
module.exports = function(value){ | ||
return regex.test(value) || regex2.test(value) | ||
} | ||
},{}],26:[function(require,module,exports){ | ||
module.exports = { | ||
toLowerFirst : _dereq_('./toLowerFirst'), | ||
toUpperFirst : _dereq_('./toUpperFirst'), | ||
separate : _dereq_('./separate'), | ||
stripWhitespace : _dereq_('./stripWhitespace'), | ||
compactWhitespace: _dereq_('./compactWhitespace'), | ||
camelize : _dereq_('./camelize'), | ||
humanize : _dereq_('./humanize'), | ||
hyphenate : _dereq_('./hyphenate') | ||
alphanum: require('./alphanum'), | ||
match : require('./match'), | ||
guid : require('./guid'), | ||
// email : require('./email'), | ||
numeric : require('./numeric') | ||
} | ||
},{"./camelize":2,"./compactWhitespace":3,"./humanize":4,"./hyphenate":6,"./separate":8,"./stripWhitespace":9,"./toLowerFirst":10,"./toUpperFirst":11}],8:[function(_dereq_,module,exports){ | ||
},{"./alphanum":24,"./guid":25,"./match":27,"./numeric":28}],27:[function(require,module,exports){ | ||
'use strict' | ||
var F = require('functionally') | ||
module.exports = F.curry(function(re, value){ | ||
return !!re.test(value) | ||
}) | ||
},{"functionally":3}],28:[function(require,module,exports){ | ||
'use strict' | ||
module.exports = require('i-s').numeric | ||
},{"i-s":4}],29:[function(require,module,exports){ | ||
'use strict' | ||
var doubleColonRe = /::/g | ||
@@ -98,3 +1022,3 @@ var upperToLowerRe = /([A-Z]+)([A-Z][a-z])/g | ||
} | ||
},{}],9:[function(_dereq_,module,exports){ | ||
},{}],30:[function(require,module,exports){ | ||
var RE = /\s/g | ||
@@ -109,3 +1033,3 @@ | ||
} | ||
},{}],10:[function(_dereq_,module,exports){ | ||
},{}],31:[function(require,module,exports){ | ||
module.exports = function(str){ | ||
@@ -116,3 +1040,3 @@ return str.length? | ||
} | ||
},{}],11:[function(_dereq_,module,exports){ | ||
},{}],32:[function(require,module,exports){ | ||
'use strict' | ||
@@ -125,5 +1049,28 @@ | ||
} | ||
},{}],12:[function(_dereq_,module,exports){ | ||
module.exports = _dereq_('./prefixer')() | ||
},{"./prefixer":18}],13:[function(_dereq_,module,exports){ | ||
},{}],33:[function(require,module,exports){ | ||
module.exports = require('./prefixer')() | ||
},{"./prefixer":40}],34:[function(require,module,exports){ | ||
'use exports' | ||
//make sure properties are in hyphenated form | ||
module.exports = { | ||
'animation' : 1, | ||
'column-count' : 1, | ||
'columns' : 1, | ||
'font-weight' : 1, | ||
'opacity' : 1, | ||
'order ' : 1, | ||
'z-index' : 1, | ||
'zoom' : 1, | ||
'flex' : 1, | ||
'box-flex' : 1, | ||
'transform' : 1, | ||
'perspective' : 1, | ||
'box-pack' : 1, | ||
'box-align' : 1, | ||
'colspan' : 1, | ||
'rowspan' : 1 | ||
} | ||
},{}],35:[function(require,module,exports){ | ||
'use strict' | ||
@@ -136,3 +1083,3 @@ | ||
} | ||
},{}],14:[function(_dereq_,module,exports){ | ||
},{}],36:[function(require,module,exports){ | ||
'use strict' | ||
@@ -146,3 +1093,3 @@ | ||
},{}],15:[function(_dereq_,module,exports){ | ||
},{}],37:[function(require,module,exports){ | ||
'use strict' | ||
@@ -157,4 +1104,4 @@ | ||
},{}],16:[function(_dereq_,module,exports){ | ||
var toUpperFirst = _dereq_('ustring').toUpperFirst | ||
},{}],38:[function(require,module,exports){ | ||
var toUpperFirst = require('ustring').toUpperFirst | ||
@@ -208,3 +1155,3 @@ var re = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/ | ||
module.exports = prefixInfo | ||
},{"ustring":7}],17:[function(_dereq_,module,exports){ | ||
},{"ustring":2}],39:[function(require,module,exports){ | ||
module.exports = { | ||
@@ -235,6 +1182,6 @@ 'border-radius' : 1, | ||
} | ||
},{}],18:[function(_dereq_,module,exports){ | ||
},{}],40:[function(require,module,exports){ | ||
'use strict' | ||
var ustring = _dereq_('ustring') | ||
var ustring = require('ustring') | ||
var camelize = ustring.camelize | ||
@@ -245,4 +1192,4 @@ var hyphenate = ustring.hyphenate | ||
var prefixInfo = _dereq_('./prefixInfo') | ||
var prefixProperties = _dereq_('./prefixProperties') | ||
var prefixInfo = require('./prefixInfo') | ||
var prefixProperties = require('./prefixProperties') | ||
@@ -319,14 +1266,15 @@ var docStyle = typeof document == 'undefined'? | ||
} | ||
},{"./prefixInfo":16,"./prefixProperties":17,"ustring":7}],19:[function(_dereq_,module,exports){ | ||
},{"./prefixInfo":38,"./prefixProperties":39,"ustring":2}],41:[function(require,module,exports){ | ||
'use strict' | ||
var ustring = _dereq_('ustring') | ||
var ustring = require('ustring') | ||
var prefixInfo = _dereq_('./prefixInfo') | ||
var cssPrefixFn = _dereq_('./cssPrefix') | ||
var prefixInfo = require('./prefixInfo') | ||
var cssPrefixFn = require('./cssPrefix') | ||
var HYPHENATE = ustring.hyphenate | ||
var HAS_OWN = _dereq_('./hasOwn') | ||
var IS_OBJECT = _dereq_('./isObject') | ||
var IS_FUNCTION = _dereq_('./isFunction') | ||
var CAMELIZE = ustring.camelize | ||
var HAS_OWN = require('./hasOwn') | ||
var IS_OBJECT = require('./isObject') | ||
var IS_FUNCTION = require('./isFunction') | ||
@@ -355,2 +1303,6 @@ var applyPrefix = function(target, property, value, normalizeFn){ | ||
var CONFIG = { | ||
cssUnitless: require('./cssUnitless') | ||
} | ||
/** | ||
@@ -377,3 +1329,6 @@ * @ignore | ||
config = config || {} | ||
config = config || CONFIG | ||
config.cssUnitless = config.cssUnitless || CONFIG.cssUnitless | ||
result = result || {} | ||
@@ -398,5 +1353,10 @@ | ||
normalizeFn = config.normalizeName || HYPHENATE, | ||
camelize = config.camelize, | ||
normalizeFn = camelize? CAMELIZE: HYPHENATE | ||
processed, | ||
// Object.keys(cssUnitless).forEach(function(key){ | ||
// cssUnitless[normalizeFn(key)] = 1 | ||
// }) | ||
var processed, | ||
styleName, | ||
@@ -418,3 +1378,3 @@ | ||
//the hyphenated style name (css property name) | ||
styleName = normalizeFn(prepend? prepend + propName: propName) | ||
styleName = HYPHENATE(prepend? prepend + propName: propName) | ||
@@ -435,3 +1395,3 @@ processed = false | ||
styleName = fnPropValue.name? | ||
normalizeFn(fnPropValue.name): | ||
HYPHENATE(fnPropValue.name): | ||
styleName | ||
@@ -461,2 +1421,4 @@ | ||
// hyphenStyleName = camelize? HYPHENATE(styleName): styleName | ||
if (processed){ | ||
@@ -485,3 +1447,3 @@ | ||
styleName = normalizeFn(styleName + '-width') | ||
styleName = styleName + '-width' | ||
} | ||
@@ -503,7 +1465,6 @@ | ||
positions[theRest].forEach(function(pos){ | ||
styleName.push(normalizeFn('border' + pos + radius)) | ||
styleName.push('border' + pos + radius) | ||
}) | ||
} else { | ||
styleName = normalizeFn('border'+ theRest + radius) | ||
styleName = 'border'+ theRest + radius | ||
} | ||
@@ -533,3 +1494,2 @@ | ||
} else { | ||
//the propValue must be an object, so go down the hierarchy | ||
@@ -544,7 +1504,7 @@ TO_STYLE_OBJECT(propValue, config, styleName + '-', result) | ||
module.exports = TO_STYLE_OBJECT | ||
},{"./cssPrefix":12,"./hasOwn":13,"./isFunction":14,"./isObject":15,"./prefixInfo":16,"ustring":7}],20:[function(_dereq_,module,exports){ | ||
},{"./cssPrefix":33,"./cssUnitless":34,"./hasOwn":35,"./isFunction":36,"./isObject":37,"./prefixInfo":38,"ustring":2}],42:[function(require,module,exports){ | ||
'use strict' | ||
var toStyleObject = _dereq_('./toStyleObject') | ||
var hasOwn = _dereq_('./hasOwn') | ||
var toStyleObject = require('./toStyleObject') | ||
var hasOwn = require('./hasOwn') | ||
@@ -577,4 +1537,3 @@ /** | ||
} | ||
},{"./hasOwn":13,"./toStyleObject":19}]},{},[1]) | ||
(1) | ||
},{"./hasOwn":35,"./toStyleObject":41}]},{},[1])(1) | ||
}); |
{ | ||
"name": "to-style", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Convert style objects to style strings", | ||
@@ -16,5 +16,3 @@ "main": "index.js", | ||
}, | ||
"dependencies": { | ||
"ustring": "^1.4.0" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -21,0 +19,0 @@ "should": "~4.0.4", |
@@ -1,3 +0,5 @@ | ||
var toUpperFirst = require('ustring').toUpperFirst | ||
'use strict'; | ||
var toUpperFirst = require('./stringUtils/toUpperFirst') | ||
var re = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/ | ||
@@ -4,0 +6,0 @@ |
'use strict' | ||
var ustring = require('ustring') | ||
var prefixInfo = require('./prefixInfo') | ||
var cssPrefixFn = require('./cssPrefix') | ||
var HYPHENATE = ustring.hyphenate | ||
var CAMELIZE = ustring.camelize | ||
var HYPHENATE = require('./stringUtils/hyphenate') | ||
var CAMELIZE = require('./stringUtils/camelize') | ||
var HAS_OWN = require('./hasOwn') | ||
@@ -11,0 +9,0 @@ var IS_OBJECT = require('./isObject') |
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
91500
0
29
2357
- Removedustring@^1.4.0
- Removedfunctionally@0.6.2(transitive)
- Removedi-s@1.2.3(transitive)
- Removednewify@1.1.9(transitive)
- Removedustring@1.4.1(transitive)