-- Select the platform using the environment.

if _G.js then
  return require "cosy.platform.js"
else
  return require "cosy.platform.standalone"
end

--     > local platform     = require "cosy.platform"
--     >> local logger      = platform.logger
--     ...
--     DEBUG logger is available using ...
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local i18n        = platform.i18n
--     ...
--     DEBUG i18n is available using ...
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local unique      = platform.unique
--
--     > local platform     = require "cosy.platform"
--     >> local table       = platform.table
--     ...
--     DEBUG table dump is available using ...
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local json        = platform.json
--     ...
--     DEBUG json is available using ...
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local yaml        = platform.yaml
--     ...
--     DEBUG yaml is available using ...
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local compression = platform.compression
--     ...
--     DEBUG compression 'none' has been loaded
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local password    = platform.password
--     ...
--     DEBUG password hashing is available using ...
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local md5         = platform.md5
--     ...
--     DEBUG md5 is available using ...
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local redis       = platform.redis
--     ...
--     DEBUG redis is available using 'fakeredis'
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local time        = platform.time
--     ...
--     DEBUG time is available using ...
--     ...
--
--     > local platform     = require "cosy.platform"
--     >> local scheduler   = platform.scheduler
--
--     > local platform     = require "cosy.platform"
--     >> local email       = platform.email
--     ...
--     DEBUG email is available using 'mock'
--     ...
--

-- Select the platform using the environment.

local version = tonumber (_VERSION:match "Lua%s*(%d%.%d)")

if version < 5.1
or (version == 5.1 and type (_G.jit) ~= "table") then
  error "Cosy requires Luajit >= 2 or Lua >= 5.2 to run."
end

if _G.js then
  return require "cosy.platform.js"
else
  return require "cosy.platform.standalone"
end
Add check on Lua version to avoid silly failures.
Add check on Lua version to avoid silly failures.
