Socket
Socket
Sign inDemoInstall

emoji-str-position

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    emoji-str-position

emoji in str position


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

emoji-str-position Build Status codecov explain

「 emoji in str position 」

Install

npm install emoji-str-position
yarn add emoji-str-position

Usage

const m = require('emoji-str-position');

const text = `
\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation)
\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji
\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base)
\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier
`;

const data = m(text);
// data.emojiPos.length === 8
data details
data.emojiIdx
//
data.emojiIdx ==
  {
    '1': true,
    '4': true,
    '64': true,
    '68': true,
    '125': true,
    '129': true,
    '174': true,
    '180': true,
  };
data.emojiPos
const emojiPos = [
  {
    emoji: '⌚',
    len: 1,
    pos: 1,
  },
  {
    emoji: '⌚',
    len: 1,
    pos: 4,
  },
  {
    emoji: '↔️',
    len: 1,
    pos: 64,
  },
  {
    emoji: '↔️',
    len: 1,
    pos: 68,
  },
  {
    emoji: '👩',
    len: 1,
    pos: 125,
  },
  {
    emoji: '👩',
    len: 1,
    pos: 129,
  },
  {
    emoji: '👩🏿',
    len: 1,
    pos: 174,
  },
  {
    emoji: '👩🏿',
    len: 1,
    pos: 180,
  },
];

the emoji length diff Between node with Browser

API

emojiStrPosition(str) : data

str
name:str
Type:string
Desc:str with/out emoji.
data
name:data
Type:Object
Opt:emojiPos
Opt:emojiIdx
emojiPos
name:emojipos
Type:Array
Opt:emoji: <source emoji>
Opt:len :< emoji length>
Opt:pos :< emoji in str index>
emojiIdx
name:emojiIdx
Type:Object
Opt:index: true
Desc:index:each emoji from pos to pos+len, be true emojiIdx[pos...(pos+len)] = true

concat

  • emoji-regex A regular expression to match all Emoji-only symbols as per the Unicode Standard.

Use by

License

MIT © chinanf-boy

FAQs

Last updated on 10 Sep 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc