{"_id":"deconstruct-number-format","_rev":"3-c82c51b34f0ebfbf85532ca00f954744","name":"deconstruct-number-format","description":"deconstruct a number format eg '-£#,##0.##0' and return a set of parameters to describe the format","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"deconstruct-number-format","version":"0.0.1","description":"deconstruct a number format eg '-£#,##0.##0' and return a set of parameters to describe the format","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"https://github.com/DeeLindesay/deconstruct-number-format.git"},"keywords":["number","format"],"author":{"name":"DeeLindesay"},"license":"MIT","dependencies":{},"devDependencies":{"testit":"~1.2.0"},"gitHead":"32bca165b9af16535e2cf8c3334a2c3bbbd8cc77","bugs":{"url":"https://github.com/DeeLindesay/deconstruct-number-format/issues"},"homepage":"https://github.com/DeeLindesay/deconstruct-number-format","_id":"deconstruct-number-format@0.0.1","_shasum":"fbb5d7dcd45bd2b2fa0e579ed91b59c7e29b386a","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"deelindesay","email":"dee@lindesay.co.uk"},"dist":{"shasum":"fbb5d7dcd45bd2b2fa0e579ed91b59c7e29b386a","tarball":"https://registry.npmjs.org/deconstruct-number-format/-/deconstruct-number-format-0.0.1.tgz","integrity":"sha512-DNkCIzxbEHIbSdC+HvN12A2te/+X7MBOvEEetxQXUHW0B9OQCgdzR5JR/dkAPr7GPOPVGGxGx+YRh0gUtJ5FWA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICuxVJBJhpfb/z/QoKngR+i4J8ELSfQi22JCmkpEtuI1AiBiK9P7O83ip1xYF1eIQWBDlMlUU0bYoDmH7bUXnweWCQ=="}]},"maintainers":[{"name":"deelindesay","email":"dee@lindesay.co.uk"}]}},"readme":"# deconstruct-number-format\r\nTo deconstruct a number format eg '-£#,##0.##0 /m', '(33 years)', '$ -99.00' and return a set of parameters to describe the format.\r\n\r\n## Accepts:\r\n- negative signs before or after prefix text\r\n- brackets as negative signs\r\n- prefix and suffix texts\r\n- `.` or `,` as decimal point\r\n- space or `.` or `,` as thousand separators\r\n- space or `.` or `,` as thousanths separators\r\n- `#`, `9` or `0` as number place holders\r\n\r\n## Returns:\r\n- negativeType: 'right', 'left', 'brackets', 'none'\r\n- negativeRightPos: 0 if right negative or bracket is at end of expression, >0 if right/bracket is followed by suffix; -1 no right negative\r\n- negativeLeftPos: 0 if right negative or bracket is at start expression, >0 if right/bracket follows prefix; -1 no left negative\r\n- suffix: text characters after number; can be ''\r\n- prefix: text characters before number (cannot include 0,9,#); can be ''\r\n- negativeLeftSymbol: left hand negative symbol (may include trailing spaces), eg '(', '( ', '- '\r\n- negativeRightSymbol: right hand negative symbol (may include leading spaces), eg ')', ' )', ' -'\r\n- decimalChar: character repesenting decimal (. or ,)\r\n- integerSeparator: separator of thousands (space or . or ,); empty string if no separator\r\n- decimalsSeparator: separator of thousanths (space or . or ,); empty string if no separator\r\n- padLeft: padding front of number, based on first postition of a zero; -1 = no padding\r\n- maxLeft: max places permitted before the dp, based on 9 or 0 as the first number holder; -1 = no max\r\n- padRight: zero padding required to right of dp, based on last postition of a zero; -1 = no padding\r\n- maxRight: max places permitted after the dp, based on 0 or 9 as the last number holder, can be 0 (integer only); -1 = no max\r\n\r\n## Notes on decimal points/thousands separators:\r\nIf a format ends in a . or , then this will be taken as the decimal character UNLESS the same character is used elsewhere so:\r\n- `#,###.`  results in decimalChar = '.', thousands separator = ','\r\n- `#.###,`  results in decimalChar = ',', thousands separator = '.'\r\n\r\nIf a format only has one of ',' or '.' and the character only appears once it is taken as the decimal point\r\n- `#,###`  results in decimalChar = ','\r\n- `#.###`  results in decimalChar = '.'\r\n\r\nIf the character appears twice it is a separator\r\n- `#,###,###`  results in decimalChar = '.', thousands separator = ','\r\n- `#.###.###`  results in decimalChar = ',', thousands separator = '.'\r\n\r\nWhen in doubt '.' is taken as the separator, so \r\n- `#.###,#` results in decimalChar = '.', thousandths separator = ','\r\nTo create the same structure with decimalChar as ',', just add a '.' at start or end or extend expression eg\r\n- `.#.###,#`\r\n- `#.###,#.`\r\n- `#.###.###,#`\r\n\r\n## Does not work for:\r\n- structured reference numbers, eg 9999-9999\r\n- ignores and removes leading and trailing spaces (but retains those between pre/post fix and negative symbols etc)","maintainers":[{"name":"deelindesay","email":"dee@lindesay.co.uk"}],"time":{"modified":"2022-06-14T22:37:16.274Z","created":"2015-07-16T14:02:03.870Z","0.0.1":"2015-07-16T14:02:03.870Z"},"homepage":"https://github.com/DeeLindesay/deconstruct-number-format","keywords":["number","format"],"repository":{"type":"git","url":"https://github.com/DeeLindesay/deconstruct-number-format.git"},"author":{"name":"DeeLindesay"},"bugs":{"url":"https://github.com/DeeLindesay/deconstruct-number-format/issues"},"license":"MIT","readmeFilename":"README.md"}