MCPcopy
hub / github.com/tdewolff/minify / offsetFromString

Function offsetFromString

_benchmarks/sample_moment.js:3322–3337  ·  view source on GitHub ↗
(matcher, string)

Source from the content-addressed store, hash-verified

3320 var chunkOffset = /([\+\-]|\d\d)/gi;
3321
3322 function offsetFromString(matcher, string) {
3323 var matches = (string || '').match(matcher),
3324 chunk,
3325 parts,
3326 minutes;
3327
3328 if (matches === null) {
3329 return null;
3330 }
3331
3332 chunk = matches[matches.length - 1] || [];
3333 parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
3334 minutes = +(parts[1] * 60) + toInt(parts[2]);
3335
3336 return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
3337 }
3338
3339 // Return a moment from input, that is local/utc/zone equivalent to model.
3340 function cloneWithOffset(input, model) {

Callers 3

sample_moment.jsFile · 0.85
getSetOffsetFunction · 0.85
setOffsetToParsedOffsetFunction · 0.85

Calls 1

toIntFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…